Class: Utility

XtraUtils.Utility(ofWhat)

Enables utilities to be added to classes.

Constructor

new Utility(ofWhat)

Create a new utility

Parameters:
Name Type Description
ofWhat function

What class are we extending?

Properties:
Name Type Description
aidsIn function

The constructor or class that this Utility expands on

utils Object

The functions to be added to the instances of this Utility.

methods Object

The functions to be added to the class constructor itself.

Source:

Methods

(static) drop(nopt) → {Array}

Gets all elements of the array except the first n elements.

Parameters:
Name Type Attributes Default Description
n number <optional>
1

The number of elements.

Source:
Returns:

The remaining elements.

Type
Array
Example
[1, 2, 3].drop(2);	// [3]

activate() → {boolean}

Activates the utilities in this Utility instance.

Source:
Returns:

Whether it succeded or not.

Type
boolean

addMethod(name, method) → {boolean}

Add a method, which will be placed as a static method on the class.

Parameters:
Name Type Description
name string

The name to register it under.

method function

The method to register.

Source:
Returns:

Success or not.

Type
boolean

addUtil(name, util) → {boolean}

Add a utility, which will be placed on class instances.

Parameters:
Name Type Description
name string

The name to register it by.

util function

The utility to register.

Source:
Returns:

Success state.

Type
boolean

deactivate() → {boolean}

Deactivates utilities and methods, putting overwritten methods back.

Source:
Returns:

Whether it succeded or not.

Type
boolean