Skip to content

Commit

Permalink
Api.triggerWidgetEvent
Browse files Browse the repository at this point in the history
  • Loading branch information
ote82 committed Oct 3, 2023
1 parent 6963a53 commit 094b4b3
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions analogic/static/assets/js/framework/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -693,3 +693,17 @@ Api.logout = function logout() {
Api.goToStartPage = function goToStartPage() {
Auth.goToStartPage();
};

Api.triggerWidgetEvent = function triggerWidgetEvent(widgetId, eventName) {
const widget = Widgets[widgetId], triggerHandlerFunctionName = eventName + 'TriggerHandler';
if (!widget) {
console.error('Unable to find ' + widgetId);
return false;
}
if (!widget[triggerHandlerFunctionName]) {
console.error('Unable to find ' + triggerHandlerFunctionName);
return false;
}
widget[triggerHandlerFunctionName]();
return true;
}

0 comments on commit 094b4b3

Please sign in to comment.