Coherent UI  2.5.3
A modern user interface library for games
 All Classes Namespaces Functions Variables Enumerations Enumerator Pages
engine Module Reference

Coherent UI JavaScript interface. The engine module contains all functions for communication between the UI and the game / application. More...

Functions

undefined on (String name, Function callback, Object context)
 Register handler for and event. More...
 
undefined off (String name, Function callback, Object context)
 Remove handler for an event. More...
 
undefined trigger (String name,...)
 Trigger an event This function will trigger any C++ handler registered for this event with Coherent::UI::View::RegisterForEvent More...
 
Deferred createDeferred ()
 Create a new deferred object. Use this to create deferred / promises that can be used together with engine.call. More...
 
Deferred call (String name,...)
 Call asynchronously a C++ handler and retrieve the result The C++ handler must have been registered with Coherent::UI::View::BindCall More...
 

Detailed Description

Coherent UI JavaScript interface. The engine module contains all functions for communication between the UI and the game / application.

Function Documentation

Deferred engine.call ( String  name,
  ... 
)

Call asynchronously a C++ handler and retrieve the result The C++ handler must have been registered with Coherent::UI::View::BindCall

Parameters
namename of the C++ handler to be called
...any extra parameters to be passed to the C++ handler
Returns
deferred object whose promise is resolved with the result of the C++ handler
Deferred engine.createDeferred ( )

Create a new deferred object. Use this to create deferred / promises that can be used together with engine.call.

Returns
a new deferred object
See Also
Customizing Promises
undefined engine.off ( String  name,
Function  callback,
Object  context 
)

Remove handler for an event.

Parameters
namename of the event, by default removes all events
callbackthe callback function to be removed, by default removes all callbacks for a given event
contextthis context for the function, by default all removes all callbacks, regardless of context
Warning
Removing all handlers for engine will remove some Coherent UI internal events, breaking some functionality.
undefined engine.on ( String  name,
Function  callback,
Object  context 
)

Register handler for and event.

Parameters
namename of the event
callbackcallback function to be executed when the event has been triggered
contextthis context for the function, by default the engine object
undefined engine.trigger ( String  name,
  ... 
)

Trigger an event This function will trigger any C++ handler registered for this event with Coherent::UI::View::RegisterForEvent

Parameters
namename of the event
...any extra arguments to be passed to the event handlers