Core
Class Hierarchy:

Namespace for core functionality.

Descendant Class Summary
Core.Arrays.LargeMap
Core.Debug
Core.ListenerList
Core.ResourceBundle

Class Method Summary
Internal _copyFunction()
Creates a duplicate copy of a function by wrapping the original in a closure.
Internal _createFunction()
Creates an empty function.
Public extend()
Creates a new class, optionally extending an existing class.
Public get()
Retrieves a value from an object hierarchy.
Internal _isVirtual()
Determines if the specified propertyName of the specified object is a virtual property, i.
Internal _inherit()
Installs properties from source object into destination object.
Public method()
Creates a new function which executes a specific method of an object instance.
Internal _processMixins()
Add properties of mixin objects to destination object.
Public set()
Sets a value in an object hierarchy.
Internal _verifyAbstractImpl()
Verifies that a concrete derivative of an abstract class implements abstract properties present in the base class.

Class Method Detail
_copyFunction
Creates a duplicate copy of a function by wrapping the original in a closure.
Parameters:
f - the function
Returns:
an effectively identical copy

_createFunction
Creates an empty function.

extend
Creates a new class, optionally extending an existing class. This method may be called with one or two parameters as follows:

Core.extend(definition) Core.extend(baseClass, definition)

Each property of the definition object will be added to the prototype of the returned defined class. Properties that begin with a dollar-sign ($) will be processed specially:

Use of this method enables a class to be derived WITHOUT executing the constructor of the base class in order to create a prototype for the derived class. This method uses a "shared prototype" architecture, where two objects are created, a "prototype class" and a "constructor class". These two objects share the same prototype, but the "prototype class" has an empty constructor. When a class created with this method is derived, the "prototype class" is used to create a prototype for the derivative.

This method will return the constructor class, which contains an internal reference to the prototype class that will be used if the returned class is later derived by this method.

Parameters:
baseClass (Function) - the base class
definition (Object) - an associative array containing methods and properties of the class
Returns:
the constructor class

get
Retrieves a value from an object hierarchy. Examples: Given the following object 'o': { a: { b: 4, c: 2 }}
Parameters:
object - an arbitrary object from which the value should be retrieved
path (Array) - an array of object property names describing the path to retrieve
Returns:
the value, if found, or null if it does not exist

_isVirtual
Determines if the specified propertyName of the specified object is a virtual property, i.e., that it can be overridden by subclasses.

_inherit
Installs properties from source object into destination object.

In the case where the destination object already has a property defined and the "virtualProperties" argument is provided, the "virtualProperties" collection will be checked to ensure that property is allowed to be overridden. If "virtualProperties" is omitted, any property may be overridden.

Parameters:
destination - the destination object
soruce - the source object
virtualProperties - (optional) collection of virtual properties from base class.

method
Creates a new function which executes a specific method of an object instance. Any arguments passed to the returned function will be passed to the method. The return value of the method will be returned by the function. CAUTION: When adding and removing methods as listeners, note that two separately constructed methods will not be treated as equal, even if their instance and method properties are the same. Failing to heed this warning can result in a memory leak, as listeners would never be removed.
Parameters:
instance - the object instance
method (Function) - the method to be invoked on the instance
Returns:
the return value provided by the method

_processMixins
Add properties of mixin objects to destination object. Mixins will be added in order, and any property which is already present in the destination object will not be overridden.
Parameters:
destination - the destination object
mixins (Array) - the mixin objects to add

set
Sets a value in an object hierarchy. Examples: Given the following object 'o': { a: { b: 4, c: 2 } }
  • Core.set(o, ["a", "b"], 5) will update the value of 'o' to be: { a: { b: 5, c: 2 } }
  • Core.set(o, ["a", "d"], 7) will update the value of 'o' to be: { a: { b: 4, c: 2, d: 7 } }
  • Core.set(o, ["e"], 9) will update the value of 'o' to be: { a: { b: 4, c: 2 }, e: 9 }
  • Core.set(o, ["f", "g"], 8) will update the value of 'o' to be: { a: { b: 4, c: 2 }, f: { g: 8 } }
  • Core.set(o, ["a"], 10) will update the value of 'o' to be: { a: 10 }
Parameters:
object - an arbitrary object from which the value should be retrieved
path (Array) - an array of object property names describing the path to retrieve
Returns:
the value, if found, or null if it does not exist

_verifyAbstractImpl
Verifies that a concrete derivative of an abstract class implements abstract properties present in the base class.
Parameters:
constructorClass - the class to verify