Class Index | File Index

Classes


Namespace system


Defined in: system.em.

Namespace Summary
Constructor Attributes Constructor Name and Description
 
Field Summary
Field Attributes Field Name and Description
<static>  
system.presences
Array
Method Summary
Method Attributes Method Name and Description
<static>  
system.basicHttpGet(type, url, headers, callback)
<static>  
system.canCreateEntity()
Tells whether the script is allowed to create a new entity
<static>  
Tells whether the script is allowed to create a new presence
<static>  
system.canEval()
<static>  
system.canImport()
Tells whether the script is allowed to import another emerson script
<static>  
system.canProx()
Tells whether the script is allowed to register for proximity queries
<static>  
system.canRecvMessage()
Tells whether the script is allowed to register to receive messages
<static>  
system.canSendMessage()
Tells whether the script is allowed to send messages
<static>  
system.changeSelf(toChangeTo)
<static>  
system.create_context()
<static>  
system.create_entity()
<static>  
system.create_presence()
<static>  
system.createEntity(position, scriptOption, initFile, mesh, scale, solidAngle)
Creates a new entity on the current entity host.
<static>  
system.createEntityFromPres(presence, script, arg, solidAngle, Mesh, scale)
Creates a new entity based on the position and space of presence passed in.
<static>  
system.createEntityScript(position, Script, Object, solidAngle, Mesh, scale, Space)
Creates a new entity on the current entity host.
<static>  
system.createPresence(firstArg, callback, A, A, position, space)
Creates a new presence for the entity.
<static>  
system.createVisible(string)
<static>  
system.deserialize(String)
<static>  
Disable restoration from storage after a crash.
<static>  
system.event(handler)
Trigger an event handler.
<static>  
system.getProxSet(presToGetSetFor)
<static>  
system.getScript()
<static>  
system.getVersion()
Gives the version of Emerson run by the entity host
<static>  
system.import(scriptFile)
Loads a file and evaluates its contents.
<static>  
system.isHeadless()
<static>  
system.killEntity()
Destroys the entity and all the presences and state associated with it if run from the root context.
<static>  
system.onPresenceConnected(callback)
Registers a callback to be invoked when a presence created within this sandbox gets connected to the world
<static>  
system.onPresenceDisconnected(callback)
Registers a callback to be invoked when a presence created within this sandbox gets disconnected from the world.
<static>  
system.prettyprint(a, obj2)
prints the argument in javascript/json style string format
<static>  
system.print(obj)
Prints the argument
<static>  
system.println(obj)
Prints the argument, followed by a newline
<static>  
system.require(filename)
Loads and evaluates a file if it has not already been loaded.
<static>  
system.reset()
Destroys all created objects, except presences in the root context.
<static>  
system.restorePresence(, , , , , , , , , , isCleared, , , , , , , query)
<static>  
system.sendHome()
<static>  
system.sendMessage(Which, Message, Visible)
<static>  
system.sendMessageUnreliable(Which, Message, Visible)
<static>  
system.sendSandbox(msg, )
Tries to send a message, msg, from the sandbox that system is instantiated in to sbox.
<static>  
system.serialize(Object)
<static>  
system.set_script()
<static>  
system.setRestoreScript(script, cb)
Set the script to execute when this object is restored after a crash.
<static>  
system.setScript(script)
Sets the script to be invoked when the system.reset is called
<static>  
system.storageCommit()
<static>  
system.storageCount(cb)
<static>  
system.storageErase(eraseKey, cb)
<static>  
system.storageRangeErase(cb)
<static>  
system.storageRangeRead(cb)
<static>  
system.storageRead(readKey, cb)
<static>  
system.storageWrite(writeKey, data, )
<static>  
system.timeout(time, callback, uint32, double, bool, bool)
<static>  
system.toString()
<static>  
Wrap a callback in a function which restores system.self to the value when the callback was setup.
Namespace Detail
system
Field Detail
<static> system.presences
Array
Method Detail
<static> system.basicHttpGet(type, url, headers, callback)
Parameters:
{String} type
(GET or POST) are only two supported for now.
{String} url
or ip address.
{String} headers
formatted as a string (with \r\n's ending each line)
{function} callback
to execute on success or failure (first arg of function is bool. If success, bool is true, if fail, bool is false). Success callbacks have a second arg that takes in an object with the following fields: respHeaders (string map). contentLength (number). status code (number). data (string).

<static> {Boolean} system.canCreateEntity()
Tells whether the script is allowed to create a new entity
Returns:
TRUE if the script is allowed to create a new entity on the current host, FALSE otherwise

<static> {Boolean} system.canCreatePresence()
Tells whether the script is allowed to create a new presence
Returns:
TRUE if the script is allowed to create a new presence for the entity, FALSE otherwise

<static> {Boolean} system.canEval()
Returns:
TRUE if eval() is invokable in the script

<static> {Boolean} system.canImport()
Tells whether the script is allowed to import another emerson script
Returns:
TRUE if the script is allowed to import an emerson script using system.import, FALSE otherwise

<static> {Boolean} system.canProx()
Tells whether the script is allowed to register for proximity queries
Returns:
TRUE if the script is allowed to register for proximity queries, FALSE otherwise

<static> {Boolean} system.canRecvMessage()
Tells whether the script is allowed to register to receive messages
Returns:
TRUE if the script is allowed to receive a message, FALSE otherwise

<static> {Boolean} system.canSendMessage()
Tells whether the script is allowed to send messages
Returns:
TRUE if the script is allowed to send a message, FALSE otherwise

<static> system.changeSelf(toChangeTo)
Parameters:
{string} toChangeTo
The sporef of the presence that we want to change self to.

<static> system.create_context()
Deprecated:
Use createSandbox

<static> system.create_entity()
Deprecated:
Use createEntity

<static> system.create_presence()
Deprecated:
Use createPresence

<static> system.createEntity(position, scriptOption, initFile, mesh, scale, solidAngle)
Creates a new entity on the current entity host.
Parameters:
{util.Vec3} position
(eg. new util.Vec3(0,0,0);). Corresponds to position to place new entity in world.
{String} scriptOption
Script option to pass in. Almost always pass "js"
{String} initFile
Name of file to import code for new entity from.
{String} mesh
Mesh uri corresponding to mesh you want to use for this entity.
{Number} scale
Scale of new mesh. (Higher number means increase mesh's size.)
{Number} solidAngle
Solid angle that entity's new presence queries with.
Deprecated:
Use createEntityScript instead.
Throws:
{Exception}
Calling create_entity in a sandbox without the capabilities to create entities throws an exception.
See:
system.canCreateEntity

<static> system.createEntityFromPres(presence, script, arg, solidAngle, Mesh, scale)
Creates a new entity based on the position and space of presence passed in.
Parameters:
presence
or visible.
pos.
Position of new entity's first presence relative to first argument's position
script
Can either be a string, which will be eval-ed on new entity as soon as it's created or can be a non-closure capturing function that will be executed with next parameter as its argument.
arg
Object Passed as argument to script argument if script argument is a function.
solidAngle
Solid angle that entity's new presence queries with.
{optional} Mesh
uri corresponding to mesh you want to use for this entity. If undefined, defaults to self's mesh.
{optional} scale
Scale of new mesh. (Higher number means increase mesh's size.) If undefined, default to self's scale.

<static> system.createEntityScript(position, Script, Object, solidAngle, Mesh, scale, Space)
Creates a new entity on the current entity host.
Parameters:
position
(eg. new util.Vec3(0,0,0);). Corresponds to position to place new entity in world.
Script
Can either be a string, which will be eval-ed on new entity as soon as it's created or can be a non-closure capturing function that will be executed with next parameter as its argument.
Object
Passed as argument to script argument if script argument is a function. Null if takes no argument.
solidAngle
Solid angle that entity's new presence queries with.
{optional} Mesh
uri corresponding to mesh you want to use for this entity. If undefined, defaults to self's mesh.
{optional} scale
Scale of new mesh. (Higher number means increase mesh's size.) If undefined, default to self's scale.
{optional} Space
to create the entity in. If undefined, defaults to self.
Throws:
{Exception}
Calling create_entity in a sandbox without the capabilities to create entities throws an exception.
See:
system.canCreateEntity

<static> system.createPresence(firstArg, callback, A, A, position, space)
Creates a new presence for the entity. There are two ways to invoke this method. You can pass it an object containing properties to set (e.g. with fields 'position', 'orientation', etc) or pass it a fixed set of arguments (mesh, callback, position, space). Only the first method allows setting all properties of the presence and is preferred. In both cases, the second argument can be a callback to be invoked when the presence is connected. By default, the presence's intial position is the same as the presence that created it and its scale is 1.
Parameters:
{string or object} firstArg
If string, will try to decode string as a mesh a uri for the new presence and callback argument is required. If it's an object, we read the fields of the object for presence initialization information. The fields of the object we read are as follows: space (string), pos(vec3), orient (quat), mesh (string), physics (string), scale (float), callback (function), solidAngleQuery(float). Any of these parameters that are undefined default to taking the equivalent value of system.self.
{function} callback Optional
function to be called when presence gets connected to the world. (Function has form func (pres), where pres contains the presence just connected.)
{optional} A
position for the new presence. Unspecified defaults to same position as self.
{optional} A
space to create the new presence in. Unspecified defaults to same space as self.
{Vec3} position Optional
requested initial position for the presence. Ignored when using an object to specify settings.
{string} space Optional
the space to connect to.
Throws:
{Exception}
if sandbox does not have capability to create presences.
Returns:
Nothing.
See:
system.canCreatePresence

<static> system.createVisible(string)
Parameters:
{String*} string
space and object id of a visible object.
Returns:
a visible object with the space and object id contained argument. Throws an exception if string is incorrectly formatted, otherwise returns vis object.

<static> system.deserialize(String)
Parameters:
String
to deserialize into an object.
Returns:
Returns an object representing the deserialized string.

<static> system.disableRestoreScript(cb)
Disable restoration from storage after a crash.
Parameters:
cb

<static> {boolean} system.event(handler)
Trigger an event handler. The handler will be added to the event queue and invoked later, i.e. on a different stack than the current one.
Parameters:
{function} handler
the event handler to invoke.
Throws:
{TypeError}
if anything besides a function is provided
Returns:
{boolean} true on success, false if the system is shutting down

<static> {object} system.getProxSet(presToGetSetFor)
Parameters:
{presence} presToGetSetFor
The presence object whose prox result set you want this function to return. If the presence object does not
Returns:
{object} Each index of object is the identifier for a separate visible object. The value of that index is the visible itself.

<static> system.getScript()
Returns:
returns the script that was set by setScript, and that is associated with this sandbox.

<static> {String} system.getVersion()
Gives the version of Emerson run by the entity host
Returns:
the version of the Emerson being run by the entity host

<static> system.import(scriptFile)
Loads a file and evaluates its contents. Note that this version *always* imports the file, even if it was previously imported.
Parameters:
{String} scriptFile
The Emerson file to import and execute in the current script
Throws:
{Exception}
If the import leads to circular dependencies, it will throw an exception. Use system.require to include each file only once.
See:
system.require

<static> system.isHeadless()
Returns:
Returns true if you are running in headless mode. Returns false otherwise.

<static> system.killEntity()
Destroys the entity and all the presences and state associated with it if run from the root context. If not run from root context, throws error.
Throws:
__killEntity__ (If kill entity command is successful)
Exception (If do not execute kill entity from root context).

<static> system.onPresenceConnected(callback)
Registers a callback to be invoked when a presence created within this sandbox gets connected to the world
Parameters:
{Function} callback
The function to be invoked. Function takes a single argument that corresponds to the presence that just connected to the world.
Returns:
does not return anything

<static> system.onPresenceDisconnected(callback)
Registers a callback to be invoked when a presence created within this sandbox gets disconnected from the world.
Parameters:
{Function} callback
the function to be invoked. Function takes a single argument that corresponds to the presence that just got disconnected from the world.
Returns:
does not return anything

<static> system.prettyprint(a, obj2)
prints the argument in javascript/json style string format
Parameters:
{Object} a
list of objects to print. Each of the objects are pretty-formatted concatenated before printing
{Object} obj2

<static> system.print(obj)
Prints the argument
Parameters:
{Object} obj
See:
system.prettyPrint

<static> system.println(obj)
Prints the argument, followed by a newline
Parameters:
{Object} obj
See:
system.prettyPrint

<static> system.require(filename)
Loads and evaluates a file if it has not already been loaded. Unlike system.import, this ensures that each file is imported at most one time. This is usually what you want to use.
Parameters:
{String} filename
The path to look for the file to include
See:
system.import

<static> system.reset()
Destroys all created objects, except presences in the root context. Then executes script associated with root context. (Use system.setScript to set this script.)
Returns:
Does not return any value
See:
system.setScript

<static> system.restorePresence(, , , , , , , , , , isCleared, , , , , , , query)
Parameters:
{string}
sporef,
{vec3}
pos,
{vec3}
vel,
{string}
posTime,
{quaternion}
orient,
{quaternion}
orientVel,
{string}
orientTime,
{string}
mesh,
{string}
physics,
{number}
scale,
{boolean} isCleared
,
{uint32}
contextId,
{boolean}
isConnected,
{function|null}
connectedCallback,
{boolean}
isSuspended,
{vec3}
suspendedVelocity,
{quaternion}
suspendedOrientationVelocity,
{string} query

<static> system.sendHome()
Returns:
void

<static> system.sendMessage(Which, Message, Visible)
Parameters:
Which
presence to send from.
Message
object to send.
Visible
to send to.

<static> system.sendMessageUnreliable(Which, Message, Visible)
Parameters:
Which
presence to send from.
Message
object to send.
Visible
to send to.

<static> system.sendSandbox(msg, )
Tries to send a message, msg, from the sandbox that system is instantiated in to sbox.
Parameters:
{object} msg
The message to deliver to sbox.
{sandbox|util.sandbox.PARENT}
(optional) sbox Should either be a sandbox object or should be the parent sandbox identifier. Marks the intended destination of msg. If undefined, just sends to parent.

<static> system.serialize(Object)
Parameters:
Object
to be serialized.
Returns:
Returns a string representing the serialized object. Takes an object and serializes it to be sent over the network, producing a string.

<static> system.set_script()
Deprecated:
You should use setScript

<static> system.setRestoreScript(script, cb)
Set the script to execute when this object is restored after a crash.
Parameters:
script
cb

<static> system.setScript(script)
Sets the script to be invoked when the system.reset is called
Parameters:
{String} script
string representing the emerson script to be invoked
Returns:
does not return any value
See:
system.reset

<static> system.storageCommit()
Parameters:
{function}
(optional) callback to execute after commit is complete. This function takes two arguments: 1) bool (whether the commit succeeded or failed; 2) an object containing all the objects that we requested to read as fields (if we requested no reads, then this is undefined.

<static> system.storageCount(cb)
Parameters:
{String} countKeyStart.
Specifies start of the range of keys in the backend storage system to count.
{String} countKeyFinish.
Specifies end of the range of keys in the backend storage system to count.
{function} cb
Callback to execute when count finishes. Takes two arguments: 1) bool (true if read succeeded, false if read failed); 2) If count succeeded, the int32_t value of the field read in (if count failed, undefined).

<static> system.storageErase(eraseKey, cb)
Parameters:
{String} eraseKey
(same as writeKey from storageCommit and readKey from storageRead). Specifies the element in the backend storage system to remove.
{function} cb
Callback to execute when remove finishes. Takes a single argument: bool (true if remov is successful, false otherwise).

<static> system.storageRangeErase(cb)
Parameters:
{String} eraseKeyStart.
Specifies start of the range of keys in the backend storage system to remove.
{String} eraseKeyFinish.
Specifies end of the range of keys in the backend storage system to remove.
{function} cb
Callback to execute when remove finishes. Takes a single argument: bool (true if remov is successful, false otherwise).

<static> system.storageRangeRead(cb)
Parameters:
{String} readKeyStart.
Specifies start of the range of keys in the backend storage system to read data from.
{String} readKeyFinish.
Specifies end of the range of keys in the backend storage system to read data from.
{function} cb
Callback to execute when read finishes. Takes two arguments: 1) bool (true if read succeeded, false if read failed); 2) If read succeeded, the value of the field read in (if read failed, undefined).

<static> system.storageRead(readKey, cb)
Parameters:
{String} readKey
(same as writeKey from storageCommit). Specifies the key in the backend storage system to read data from.
{function} cb
Callback to execute when read finishes. Takes two arguments: 1) bool (true if read succeeded, false if read failed); 2) If read succeeded, the value of the field read in (if read failed, undefined).

<static> system.storageWrite(writeKey, data, )
Parameters:
{String} writeKey
The field to write these data into. Later, can use writeKey to read from stored data.
{String} data
serialized data to put in storage.
{function}
(optional) cb Callback to execute when write has completed. Takes a single argument: bool as to whether the write succeeded (true) or failed (false).

<static> system.timeout(time, callback, uint32, double, bool, bool)
Parameters:
{Number} time
number of seconds to wait before executing the callback
{function} callback
The function to invoke once "time" number of seconds have passed
{Reserved} uint32
contextId
{Reserved} double
timeRemaining
{Reserved} bool
isSuspended
{Reserved} bool
isCleared
Returns:
a object representing a handle for this timer. This handle can be used in future to suspend and resume the timer

<static> {String} system.toString()
Returns:
the string representation of the system object
See:
system.print
system.prettyprint

<static> system.wrapCallbackForSelf(cb)
Wrap a callback in a function which restores system.self to the value when the callback was setup.
Parameters:
cb

Documentation generated by JsDoc Toolkit 2.4.0 on Wed Jun 27 2012 00:16:03 GMT-0700 (PDT)