- Description
- How to use it
Description
Global Framework Hooks allows the developers to handle process across the whole application with listeners and execution of logic.
How to use it
When creating new objects and screens the developer can set individual events in attributes using the Object Designer but there are cases where you would like logic to execute for every object of the same type. For this scenario the developers can use the framework global hooks.
Besides the object types also other components like the DESKTOP are made available via the Global Framework Hooks. The Framework Hooks are composed out of the namespaces added on the akioma.swat.GlobalHooks object, for eg. akioma.swat.GlobalHooks.WINDOW.CLOSE which holds the information: for what object and for what event. Also for setting up event listeners the akioma.swat.GlobalEmitter object is made available. The object has methods for adding and removing event listeners: on, off, once, emit.
Some examples of using Global Framework Hooks:
akioma.eventEmitter.on(akioma.swat.GlobalHooks.OBJECT.BEFORE_DESTROY, (event) => {
const elm = akioma.swat.App.getObjectByName(event);
if (elm.view === 'panelset')
console.log('elm', elm);
});Back to Documentation
Back to Home Page