While creating your scripts you might run into situations where you'd like to analyze what events take place and determine how to best implement your scripts. The following scripts will allow you to do so by dumping the information into your console window (Developer Tools):
Add the following code to your dashboard script:
dashboard.on('initialized', function(dashboard) {
console.log('Dashboard ' + dashboard.oid + ' - Event "initialized"')
Object.keys(dashboard.$$events).forEach(keyName => {
if (keyName.startsWith('widget'))
dashboard.on(keyName,function(dash,widget) {
console.log('Dashboard ' + dashboard.oid + ' - Event "' + keyName + '" for widget ' + widget.widget.oid)
})
else
dashboard.on(keyName,function() {
console.log('Dashboard ' + dashboard.oid + ' - Event "' + keyName + '"')
})
})
})
Example Output:
Add the following code to your widget script:
widget.on('initialized', function(widget) {
console.log('Widget ' + widget.oid + ' - Event "initialized"')
Object.keys(widget.$$events).forEach(keyName => widget.on(keyName,function() {
console.log('Widget ' + widget.oid + ' - Event "' + keyName + '"')
}))
})
Example Output:
Add the following code to your dashboard script:
dashboard.on('initialized', function(dashboard) {
console.log('Dashboard ' + dashboard.oid + ' - Event "initialized"')
Object.keys(dashboard.$$events).forEach(keyName => {
if (keyName.startsWith('widget'))
{
dashboard.on(keyName,function(dash,widget) {
console.log('Dashboard ' + dashboard.oid + ' - Event "' + keyName + '" for widget ' + widget.widget.oid)
})
}
else
{
dashboard.on(keyName,function() {
console.log('Dashboard ' + dashboard.oid + ' - Event "' + keyName + '"')
})
}
})
dashboard.widgets.$$widgets.forEach(widget => {
Object.keys(widget.$$events).forEach(keyName => widget.on(keyName,function() {
console.log('Widget ' + widget.oid + ' - Event "' + keyName + '"')
}))
})
})
Example Output: