Class Index | File Index

Classes


Namespace R.engine.Support

A static class with support methods the engine or games can use. Many of the methods can be used to manipulate arrays. Additional methods are provided to access query parameters, and generate or read JSON. A system capabilities method, #sysInfo, can be used to query the environment for support of features.
Defined in: engine.support.js.

Namespace Summary
Constructor Attributes Constructor Name and Description
 
Method Summary
Method Attributes Method Name and Description
<static>  
R.engine.Support.arrayRemove(array, obj)
Remove an element from an array.
<static>  
R.engine.Support.checkBooleanParam(paramName)
Check for a query parameter and to see if it evaluates to one of the following: true, 1, yes, or y.
<static>  
R.engine.Support.checkNumericParam(paramName, val)
Check for a query parameter and to see if it evaluates to the specified number.
<static>  
R.engine.Support.checkStringParam(paramName, val)
Check for a query parameter and to see if it evaluates to the specified value.
<static>  
R.engine.Support.fillArray(arr, size, value)
Fill the specified array with size elements each with the value "value".
<static>  
R.engine.Support.filter(array, fn, thisp)
Calls a provided callback function once for each element in an array, and constructs a new array of all the values for which callback returns a true value.
<static>  
R.engine.Support.forEach(array, fn, thisp)
Executes a callback for each element within an array.
<static>  
R.engine.Support.getNumericParam(paramName, defaultVal)
Get a numeric query parameter, or the default specified if the parameter doesn't exist.
<static>  
R.engine.Support.getPath(url)
Get the path from a fully qualified URL, not including the trailing slash character.
<static>  
R.engine.Support.getQueryParams()
Get the query parameters from the window location object.
<static>  
R.engine.Support.getStringParam(paramName, defaultVal)
Get a string query parameter, or the default specified if the parameter doesn't exist.
<static>  
R.engine.Support.indexOf(array, obj, from)
Get the index of an element in the specified array.
<static>  
R.engine.Support.isEmpty(str)
Returns true if the string, after trimming, is either empty or is null.
<static>  
R.engine.Support.parseJSON(jsonString)
Parses specified JavaScript Object Notation (JSON) string back into its corresponding object.
 
Displays the virtual D-pad on the screen, if enabled via R.Engine.options.useVirtualControlPad, and wires up the appropriate events for the current browser.
<static>  
R.engine.Support.sysInfo()
Gets an object that is a collation of a number of browser and client settings.
<static>  
R.engine.Support.toJSON(object)
Returns specified object as a JavaScript Object Notation (JSON) string.
<static>  
R.engine.Support.whenReady(obj, fn)
When the object is no longer undefined, the function will be executed.
Namespace Detail
R.engine.Support
Method Detail
<static> R.engine.Support.arrayRemove(array, obj)
Remove an element from an array. This method modifies the array directly.
Parameters:
array
{Array} The array to modify
obj
{Object} The object to remove

<static> {Boolean} R.engine.Support.checkBooleanParam(paramName)
Check for a query parameter and to see if it evaluates to one of the following: true, 1, yes, or y. If so, returns true.
Parameters:
paramName
{String} The query parameter name
Returns:
{Boolean} true if the query parameter exists and is one of the specified values.

<static> {Boolean} R.engine.Support.checkNumericParam(paramName, val)
Check for a query parameter and to see if it evaluates to the specified number. If so, returns true.
Parameters:
paramName
{String} The query parameter name
val
{Number} The number to check for
Returns:
{Boolean} true if the query parameter exists and is the value specified

<static> {Boolean} R.engine.Support.checkStringParam(paramName, val)
Check for a query parameter and to see if it evaluates to the specified value. If so, returns true.
Parameters:
paramName
{String} The query parameter name
val
{String} The value to check for
Returns:
{Boolean} true if the query parameter exists and is the value specified

<static> R.engine.Support.fillArray(arr, size, value)
Fill the specified array with size elements each with the value "value". Modifies the provided array directly.
Parameters:
{Array} arr
The array to fill
{Number} size
The size of the array to fill
{Object} value
The value to put at each index

<static> R.engine.Support.filter(array, fn, thisp)
Calls a provided callback function once for each element in an array, and constructs a new array of all the values for which callback returns a true value. callback is invoked only for indexes of the array which have assigned values; it is not invoked for indexes which have been deleted or which have never been assigned values. Array elements which do not pass the callback test are simply skipped, and are not included in the new array.
Parameters:
array
{Array} The array to filter.
fn
{Function} The callback to invoke. It will be passed three arguments: The element value, the index of the element, and the array being traversed.
thisp Optional, Default: null
{Object} Used as this for each invocation of the callback.

<static> R.engine.Support.forEach(array, fn, thisp)
Executes a callback for each element within an array.
Parameters:
array
{Array} The array to operate on
fn
{Function} The function to apply to each element. It will be passed three arguments: The element value, the index of the element, and the array being traversed.
thisp Optional, Default: null
{Object} An optional "this" pointer to use in the callback

<static> {Number} R.engine.Support.getNumericParam(paramName, defaultVal)
Get a numeric query parameter, or the default specified if the parameter doesn't exist.
Parameters:
paramName
{String} The name of the parameter
defaultVal
{Number} The number to return if the parameter doesn't exist
Returns:
{Number} The value

<static> {String} R.engine.Support.getPath(url)
Get the path from a fully qualified URL, not including the trailing slash character.
Parameters:
url
{String} The URL
Returns:
{String} The path

<static> {Object} R.engine.Support.getQueryParams()
Get the query parameters from the window location object. The object returned will contain a key/value pair for each argument found.
Returns:
{Object} A generic Object with a key and value for each query argument.

<static> {String} R.engine.Support.getStringParam(paramName, defaultVal)
Get a string query parameter, or the default specified if the parameter doesn't exist.
Parameters:
paramName
{String} The name of the parameter
defaultVal
{String} The string to return if the parameter doesn't exist
Returns:
{String} The value

<static> R.engine.Support.indexOf(array, obj, from)
Get the index of an element in the specified array.
Parameters:
array
{Array} The array to scan
obj
{Object} The object to find
from Optional, Default: 0
{Number} The index to start at, defaults to zero.

<static> {Boolean} R.engine.Support.isEmpty(str)
Returns true if the string, after trimming, is either empty or is null.
Parameters:
str
{String} The string to test
Returns:
{Boolean} true if the string is empty or null

<static> R.engine.Support.parseJSON(jsonString)
Parses specified JavaScript Object Notation (JSON) string back into its corresponding object.
Parameters:
jsonString
Deprecated:
Use JSON.parse() instead
Returns:
Object
See:
http://www.json.org

showDPad()
Displays the virtual D-pad on the screen, if enabled via R.Engine.options.useVirtualControlPad, and wires up the appropriate events for the current browser.

<static> {Object} R.engine.Support.sysInfo()
Gets an object that is a collation of a number of browser and client settings. You can use this information to tailor a game to the environment it is running within.
Returns:
{Object} An object with system information

<static> R.engine.Support.toJSON(object)
Returns specified object as a JavaScript Object Notation (JSON) string.
Parameters:
object
{Object} Must not be undefined or contain undefined types and variables.
Deprecated:
Use JSON.stringify()
Returns:
String

<static> R.engine.Support.whenReady(obj, fn)
When the object is no longer undefined, the function will be executed.
Parameters:
obj
{Object} The object to wait for
fn
{Function} The function to execute when the object is ready

Documentation generated by JsDoc Toolkit 2.4.0 on Mon Mar 18 2013 16:09:18 GMT-0400 (EDT)