13. Context¶
Warning
This section contains advanced feature of Haka.
- object Context¶
Haka define a global context and local scopes. Both allow user to register events and to trigger them.
- context.signal(emitter, event, ...)¶
Parameters: - emitter (Object) – The emitter of the event.
- event (Event) – The event to trigger.
- ... – Optionnal parameters of the event.
Trigger an event on the global context and optionnaly on the current scope.
- context.newscope()¶
Create a new scope.
- context.exec(scope, func)¶
Parameters: - scope (Scope) – A local scope.
- func (function) – The function to execute.
Execute func under the given scope.