Section C.1. JavaScript Extensions


C.1. JavaScript Extensions

Atlas extends some standard JavaScript objects like strings and Booleans with additional methods.

C.1.1. Function Extensions

Method

Description

abstractMethod()

Dummy type for abstract methods

createCallback(method, context)

Creates a callback method and provides the context as parameter

createCallbackWithArguments(method, context)

Creates a callback method and uses additional parameters provided to the method

createDelegate(instance, method)

Creates a delegate

emptyMethod()

Dummy type for empty methods

getBaseMethod(instance, methodName)

Returns the method with the given name from the base object

getBaseType()

Returns the method's base type

getName()

Returns the method name

parse(functionName)

Returns a reference to the function provided as string parameter

callBaseMethod(instance, methodName, baseArguments)

Calls the method with the given name from the base object, providing the arguments in the third parameter

implementsInterface(interfaceType)

Determines whether object implements the given interface or not

inheritsFrom(parentType)

Determines whether the object inherits from the given type or not

initializeBase(instance, baseArguments)

Calls the base argument's initializing method

isImplementedBy(instance)

Determines whether the object is implemented by the given instance or not

isInstanceOfType(instance)

Determines whether the given instance is an instance of the current type

registerBaseMethod(instance, methodName)

Registers the given method as base method

createInstance(type)

Returns an instance of the given type

registerClass(typeName, baseType, interfaceType)

Registers a class with the given type name, using the base type and the interface type

registerAbstractClass(typeName, baseType)

Registers an abstract class

registerSealedClass(typeName, baseType)

Registers a sealed class

registerInterface(typeName)

Registers an interface

registerNamespace(namespacePath)

Registers a namespace


C.1.2. Object Extensions

Method

Description

getType(instance)

Returns the constructor of the instance


C.1.3. Boolean Extensions

Method

Description

parse(value)

Converts the value into a Boolean


C.1.4. Number Extensions

Method

Description

parse(value)

Converts the value into a numerical value


C.1.5. String Extensions

Method

Description

endsWith(suffix)

Whether a string ends with the given suffix or not

startsWith(prefix)

Whether a string starts with the given prefix or not

trimLeft()

Removes whitespace at the beginning of the string

trimRight()

Removes whitespace at the end of the string

trim()

Removes whitespace at both ends of the string

format(format)

Replaces placeholders {0}, {1}, ... in the string with values provided as additional parameters


C.1.6. Array Extensions

Method

Description

add(item)

Adds an element to the array

addRange(items)

Adds elements to the array

clear()

Empties the array

clone()

Creates a copy of the array

contains(item)

Whether the array contains an item or not

dequeue()

Removes (and returns) the first element of an array

indexOf(item)

Returns the zero-based index of the element in the array, or -1 if not found

insert(index, item)

Adds an item at the given position to the array

queue(item)

Adds an element to the array

remove(item)

Removes an item from the array

removeAt(index)

Removes the item at the given position from the array

parse(value)

Converts the value to an array

get_length()

Retrieves the length of the array

getItem(index)

Retrieves the array element at the given index


C.1.7. RegEx Extensions

Method

Description

parse(value)

Converts the value into a regular expression object


C.1.8. Date Extensions

Method

Description

serialize()

Returns a JavaScript command that calculates the current date





Programming Atlas
Programming Atlas
ISBN: 0596526725
EAN: 2147483647
Year: 2006
Pages: 146

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net