The singleton object initiated upon process startup which manages all active Context instances, runs the render dispatch loop, and acts as a listener and dispatcher for events. All methods are therefore static. On static initialization, window.requestAnimationFrame is called with the event loop function. Note: Any window in which Engine runs will prevent default scrolling behavior on the 'touchmove' event.
Inside requestAnimationFrame loop, step() is called, which: calculates current FPS (throttling loop if it is over limit set in setFPSCap), emits dataless 'prerender' event on start of loop, calls in order any one-shot functions registered by nextTick on last loop, calls Context.update on all Context objects registered, and emits dataless 'postrender' event on end of loop.
Initialize famous for app mode
Add event handler object to set of downstream handlers.
Remove handler object from set of downstream handlers. Undoes work of "pipe".
Bind a callback function to an event type handled by this object.
Trigger an event, sending to all downstream handlers listening for provided 'type' key.
Unbind an event by type and handler. This undoes the work of "on".
Return the current calculated frames per second of the Engine.
Set the maximum fps at which the system should run. If internal render loop is called at a greater frequency than this FPSCap, Engine will throttle render and update until this rate is achieved.
Return engine options.
Set engine options
Creates a new Context for rendering and event handling with provided document element as top of each tree. This will be tracked by the process-wide Engine.
Registers an existing context to be updated within the run loop.
Returns a list of all contexts.
Removes a context from the run loop. Note: this does not do any cleanup.
Queue a function to be executed on the next tick of the Engine.
Queue a function to be executed sometime soon, at a time that is unlikely to affect frame rate.