-
Notifications
You must be signed in to change notification settings - Fork 48
Gladius api reference
This page is under construction. We happily accept contributions!
After importing gladius.js
, a global name gladius
is created on the window
object. Use 'gladius.create' to obtain an engine instance.
Creates a new engine instance, passing options
to the constructor and invoking callback
that accepts the constructed engine instance as its only parameter.
An engine instance is returned from gladius.create
. The engine contains some facilities for scheduling tasks (engine.scheduler
), dispatching work units to workers using a thread pool (engine.threadpool
), and a math library (engine.math
) that provides functionality not available in JavaScript's Math
. In addition, the engine manages a collection of entities.
Base provides constructors to extend the engine with new components, resources, and services.
Some core functionality is provided by the engine itself.
Parts of the engine API are asynchronous, and some functions accept callbacks in their options. If the callback is invoked unconditionally it should be named callback
:
f({
callback: foo
});
If the callback is invoked only on success it should be named 'onsuccess', and there should be an additional parameter named 'onfailure' that is invoked otherwise:
g({
onsuccess: foo,
onfailure: bar
});
Some functions invoke their success callback multiple times. These functions accept an oncomplete
callback that is invoked after the final onsuccess
callback, and an onprogress
callback that is invoked periodically to provided status.
h({
onsuccess: foo,
onfailure: bar,
oncomplete: baz,
onprogress: function( options ) {
// We could update a progress bar here
}
});