XYZCommander uses mechanism of events to notify parts of the system about workflow and hooks system to handle the events.
Main characters in this play are event, hook, hooks manager
Event is fired by different parts of the system, mainly plugins, when some pre-defined action is about to occur. Event is represented by a string. When fired from the plugins it has form: event:<plugin>:<path>:<event_name>. An event can carry zero or more arguments along with it.
For example, before passing a typed command to shell, method :core:shell:execute fires an event event:core:shell:execute with typed command as an argument.
Hooks manager is an internal events dispatcher. Its main purpose is to call user-defined hooks, when an event occurs.
Hook is a user-defined action to be performed when an event occurs. A hook can be established by calling HookManager instance’s (xyz.hm) register() method, or by using hook() function in configs.
List of events fired by core system:
Event is fired after XYZCommander initialization is done.
Arguments: no
Event is fired before XYZCommander shuts down.
Arguments: no
Event is fired when plugin is about to be loaded.
Arguments: Namespace instance
Event is fired before calling plugin prepare() method.
Arguments: Plugin instance
Event is fired when a plugin method is about to be loaded.
Arguments: Plugin Namespace instance, and method name.
Event is fired when a data object is about to be loaded.
Arguments: Plugin Namespace instance, an object name.
Event is fired when plugin is shutting down.
Arguments: Plugin instance
Event is fired when configuration parameter is changed via let() function.
Arguments: Variable, Value, Section