Hi rvickersevotix ,
Yes, that is possible, if a widget script can add the functionality it is possible to nest the widget script within a dashboard script to run within every widget.
An example of running a widget script for every widget in a dashboard is:
dashboard.on('initialized', function (dash_ev,dash_se) {
dashboard.widgets.$$widgets.forEach((widget, index) => {
console.log(widget.title);
widget.on('ready', function (ev, se) {
console.log(ev.title, ' in event function');
})
})
})
dashboard.on('widgetinitialized', function (dash_se, dash_ev) {
dash_ev.widget.on('ready', function (ev, se) {
console.log(ev.title);
})
})
If it only applies to a certain widget type, a conditional can be used based on the widget.type value to only run on that widget type.