Search:
jbooze.js
file jbooze.js
Version:
0.55
Class Summary
Base class for jbooze exceptions
Structure Summary
Structure containing jBooze configuration.
Variable Summary
Special exception that is used to break iterators
function()[] _closeHooks
array of functions that should be called on app shutdown
object _global
Contains reference to global namespace
string _startupFile
default name of startup file.
Function Summary
Adds two numbers together.
addUnloadHook(function() func)
Adds a shutdown hook - a function that should be called at app shutdown
Execute a function for each element of array or member of structure
isEmpty(object obj)
Checks if the structure is empty, i.e.
notImplemented(string methodName)
Used to indicate that method is not implemented/abstract by throwing Exception
Searches for item in array
Converts argument to array, if possible.
Function Interface Summary
Variable Details
variable public static string $break
Special exception that is used to break iterators
Defined in jbooze.js
variable function()[] _closeHooks
array of functions that should be called on app shutdown
Defined in jbooze.js
variable object _global
Contains reference to global namespace
Defined in jbooze.js
variable string _startupFile
default name of startup file. comment for this member is an example of usage of var alias
Defined in jbooze.js
Function Details
function add
public static int add(int first, [int second])
Adds two numbers together. Sample only.
Could be used as mixin to SomeClass
Parameters:
first - first number[second] - second number sum of two numbers
Throws:
InvalidArgumentException when shit happens
Version:
0.55
Since:
Defined in jbooze.js
0.9
function addUnloadHook
addUnloadHook(function() func)
Adds a shutdown hook - a function that should be called at app shutdown
Parameters:
func - hook that should be called at shutdownfunction forEach
forEach(array arr, iteratorCallback func, boolean backwards)
forEach(object obj, iteratorCallback func)
Execute a function for each element of array or member of structure
Parameters:
Syntax 1 - array based (iteration over array elements)
arr - array to be iteratedfunc - function to be called for each array element.backwards - if iteration should start from the end of the array.
This is optional parameter, default value is "false". Iteration from the end of the array could be
useful when iterator function removes elements from the array Syntax 2 - object based (iteration over object properties)
obj - source objectfunc - function to be called for each object property.
See also:
Version:
0.55
Since:
Defined in jbooze.js
0.1
function isEmpty
isEmpty(object obj)
Checks if the structure is empty, i.e. does not have any members
Parameters:
obj structure true if structure has at least one member
Defined in jbooze.js
function notImplemented
notImplemented(string methodName)
Used to indicate that method is not implemented/abstract by throwing Exception
Parameters:
methodName name of the method that is not implementedfunction search
int search(array arr, object item, function (item, arrayItem) comparator)
Searches for item in array
Parameters:
arr - array containing dataitem - item that is being searched forcomparator (optional) - if specified, then
returns -1 when item < arrayItem;
returns 0 if item == arrayItem;
returns 1 otherwise the index where item was found or -1 otherwise
Defined in jbooze.js
function toArray
array toArray(object data)
Converts argument to array, if possible. If data is array, then copy of data is returned.
If data has method toArray then the result of that method is returned. If data has property length, then it is assumed
that it is possible to iterate over elements of data as if over array. If neither of these conditions are met, then
empty array is returned.
Parameters:
data - object that should be converted to array result of conversion to array
Defined in jbooze.js
Function Interface Details
ifunction iteratorCallback
iteratorCallback(item, int index)
iteratorCallback(key, value)
callback for iterators
Parameters:
Syntax 1 - iterating over arrays or collections
item - current item in array/collection/etcindex - index of item in array/collection/etc Syntax 2 - iterating over maps
key - value in the mapvalue - key of the value
If you are interested in jBooze library, see jbooze.com