Coherent UI JavaScript interface. The engine
module contains all functions for communication between the UI and the game / application.
More...
Coherent UI JavaScript interface. The engine
module contains all functions for communication between the UI and the game / application.
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
-
name | name 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
-
name | name of the event, by default removes all events |
callback | the callback function to be removed, by default removes all callbacks for a given event |
context | this 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
-
name | name of the event |
callback | callback function to be executed when the event has been triggered |
context | this 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
-
name | name of the event |
... | any extra arguments to be passed to the event handlers |