SDK3DVerse. notifier

EventEmitter object. Used to subscribe to all events emitted from the SDK. These events include onEntityCreated, onEntitiesUpdated, onFramePostRender, and more. You can register and deregister callbacks to events with on and off.

Example

function onEntityCreated(createdEntity)
{
     console.log(createdEntity.getName(), 'was created!');
}
// Register callback
SDK3DVerse.notifier.on('onEntityCreated', onEntityCreated);
// Unregister callback
SDK3DVerse.notifier.off('onEntityCreated', onEntityCreated);

Methods

off(eventName, callback) → {EventEmitter}

Unregister callback function to the event named eventName. When the specified event is emitted, the unregistered callback functions will no longer be called.

Parameters:
NameTypeDescription
eventNamestring

The name of the event

callbackfunction

The callback function. What the function takes as parameter(s) depends on the parameters of the event. See events below

Returns:

Returns a reference to the EventEmitter , so that calls can be chained.

Type: 
EventEmitter

on(eventName, callback) → {EventEmitter}

Register a callback function to the event named eventName. When the specified event is emitted, all registered callback functions will be called.

Parameters:
NameTypeDescription
eventNamestring

The name of the event

callbackfunction

The callback function. What the function takes as parameter(s) depends on the parameters of the event. See events below

Returns:

Returns a reference to the EventEmitter , so that calls can be chained.

Type: 
EventEmitter