API Docs for:
Show:

core.Core Class

This really isn't a class. These are actually standalone functions.

Methods

enumeration

(
  • namesToValues
)

This function creates a new enumerated type. The argument object specifies the names and values of each instance of the class. The return value is a constructor function that identifies the new class. Note, however that the constructor throws an exception: you can't use it to create new instances of the type. The returned constructor has properties that map the name of a value to the value itself, and also a values array, a foreach() iterator function

Parameters:

  • namesToValues Object

    an object with named values

Returns:

an enumeration

inherit

(
  • p
)
Object

Returns a newly created object that inherits properties from the prototype object p. It uses the ECMAScript 5 function Object.create() if it is defined, and otherwise falls back to an older technique.

Parameters:

  • p Object

    Non-null object. P stands for parent. It's the object to extend

Returns:

Object:

An object that extends p.

makeAnonymousAction

(
  • inputObject
  • inputFunction
  • args
)

This makes a function that can be set as an onclick, etc. If the inputFunction is a string, the return function when run will attempt to find that function on the inputObject. That means that it's possible to change the function on the inputObject without having to call this again.

If the inputFunction is a function and not a string, then the function is stored.

In both cases, the returned function will take the inputFunction and run it with any references to "this" in the inputFunction refering to the inputObject. The args are passed and the "this" reference change is done using the native JS function "apply".

Parameters:

  • inputObject Object

    The object to be refered to as "this" in the inputFunction

  • inputFunction String | | Function

    The function that needs to be run. If it's a string, when it's requested to run it's looked up dynamically on the inputObject

  • args Array

    An array of arguements to be passed to the inputFunction

    Returns:

    A function that when run, will run inputFunction.apply(inputObject, args);