This Component will help you to create reusable components.
To Init your target component, place the manager inside and hit the Init-Button. This will generate two new parameters on the top level. (Adjust the owner-parameter if the manager is nested deeper then one level)
The enduser can now create new callback-dats for your comp.
To execute a callback from your code, call the Execute-method of the manager like:
op('callbackManager').Execute("Example")("Hello World", keyword = "keywordvalue)
This might look strange, but the Execute method returns the actual callback-method which can then directly be called with a second methodcall, passing arguments.
Never store the returned callback directly, always use the Execute-method.
Alternative, you can execute a callback directly using the Do_Callback( name, arguments, keywordarguments) method, which executes the callback in a trycatch block.
op("callbackManager").Do_Callback( "Example", "Hello World", keyword="My Keyword")
For simplicity, store the callbackmanager in your Extension as callbacks for easy use.
- Owner: The component this one is attached to. Normaly it is the parrent, but you can also have it beside certain components.
- Init: Creates parameters on the owner.
- Graceful Error: Catches exceptions during execution to not hinder further execution and logs a message to the textport.