12. Context


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, ...)
  • 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.


Create a new scope.

context.exec(scope, func)
  • scope (Scope) – A local scope.
  • func (function) – The function to execute.

Execute func under the given scope.