nge

nge

The base namespace for NGE library.

Classes

Uri
Url

Members

(static, constant) CLIB_CSS :number

The CSS style sheet component.
Type:
  • number

(static, constant) CLIB_JS :number

The JavaScript component loaded in page header.
Type:
  • number

(static, constant) CLIB_POST_JS :number

The JavaScript component loaded in page body.
Type:
  • number

(static, constant) CLIB_PRE_HTML :number

The inline HTML component (included at begining of body).
Type:
  • number

(static, constant) EVENT_PREVENT :number

The flag to prevent default action of an event.
Type:
  • number

(static, constant) EVENT_STOP :number

The flag to stop propagation of an event.
Type:
  • number

(static, constant) EVENT_STOP_IMMEDIATE :number

The flag to stop immediate propagation of an event.
Type:
  • number

Methods

(static) clib(type, name, comp, idopt)

Loads required client library or external script.
Parameters:
Name Type Attributes Description
type string The type of required library. Allowed values are 'clib', 'external' or 'inline'.
name string The client library name, external script URL, inline script or HTML content.
comp int The component identifier.
id string <optional>
The inline component identifier.

(static) create(…varargs) → {Object}

Creates new object built from property and value pairs provided as argument(s).
Parameters:
Name Type Attributes Description
varargs * <repeatable>
The variable list of property and value pairs or single array containing such pairs.
Returns:
The created object.
Type
Object

(static) extend(subclass, superclass)

Extends superclass with subclass. Must be invoked after subclass prototype definition.
Parameters:
Name Type Description
subclass function The subclass constructor.
superclass function The superclass constructor.

(static) firstOf(obj) → {Array}

Returns first property and value pair of an object.
Parameters:
Name Type Description
obj Object The object.
Returns:
An array with property as first and value as second element, or null when object is empty.
Type
Array

(static) hasClass(elem, classes) → {boolean}

Determines whether element has the given class(es). If multiple classes are specified, all of them must be present for function to return true.
Parameters:
Name Type Description
elem DOMElement | jQuery The element to test.
classes string The class name or multiple names separated by space.
Returns:
true if element has all classes, false otherwise.
Type
boolean

(static) inDom((|{DOMElement})) → {boolean}

Determines whether element is still in DOM.
Parameters:
Name Type Description
(|{DOMElement}) jQuery elem The element.
Returns:
true if element is in DOM, false otherwise.
Type
boolean

(static) instanceOf(subclass, superclass) → {boolean}

Determines whether class is instance of another class. Similar to instanceof operator with exception that subclass argument is name of class instead of class instance.
Parameters:
Name Type Description
subclass string The subclass name.
superclass function The superclass constructor.
Returns:
true if subclass is instance of superclass, false otherwise.
Type
boolean

(static) isEmpty(value) → {boolean}

Determines whether value is empty.
Parameters:
Name Type Description
value string | Array | Object | jQuery The value.
Returns:
true if value is empty, false otherwise.
Type
boolean

(static) isEnumerated(value, enm) → {boolean}

Determines whether value is contained in enumeration.
Parameters:
Name Type Description
value * The value.
enm Object The enumeration.
Returns:
true if value is enumerated, false otherwise.
Type
boolean

(static) keyOf(obj, value) → (nullable) {string}

Returns object's property name having specified value.
Parameters:
Name Type Description
obj Object The object.
value * The value to search for.
Returns:
the property name or null if no property was found.
Type
string

(static) keys(The) → {Array}

Returns an array of a given object's own enumerable properties.
Parameters:
Name Type Description
The Object | Array object whose enumerable own properties are to be returned.
Returns:
an array whose elements are strings corresponding to the enumerable properties found directly upon object.
Type
Array

(static) nullable(value) → {*}

Returns the given value, or null if it is an empty object or array.
Parameters:
Name Type Description
value string | Array | Object | jQuery The value.
Returns:
the value or null if value is empty.
Type
*

(static) patch(obj, path, value, missingOnlynullable) → {*}

Patches the object property.
Parameters:
Name Type Attributes Description
obj Object The object to patch.
path string The property path in dot notation to patch in object.
value * The new value to define.
missingOnly boolean <nullable>
The flag indicating whether only existing property should be patched. The default value is false.
Returns:
the value of existing property or undefined if property was not defined.
Type
*

(static) pnmatch(pattern, obj) → {Array}

Matches property names of an object against specified regular expression.
Parameters:
Name Type Description
pattern string | RegExp The regular expression pattern.
obj Object The object.
Returns:
Returns an array of matched property names.
Type
Array

(static) proxy(fn, context) → {function}

Returns anonymous function which will invoke original function with given context outside of current invocation time-frame (e.g. outside of event handler). If the context is undefined, the context of an original call will be used.
Parameters:
Name Type Description
fn function The function whose context will be changed.
context Object The object to which the context "this" of the function should be set.
Returns:
Anonymous function.
Type
function

(static) proxyEvent(cancel, fn, context) → {function}

The version of nge.proxy method for use with events. The "this" invocation context is passed as first argument to original function.
Parameters:
Name Type Description
cancel number The flag indicating whether event handling should be modified. The value should be bitwise combination of nge.EVENT_* constants.
fn function The function whose context will be changed.
context Object The object to which the context "this" of the function should be set.
Returns:
Anonymous function.
Type
function

(static) sizeOf(obj) → {number}

Returns the number of properties in an object or elements in an array.
Parameters:
Name Type Description
obj Array | Object The object or an array.
Returns:
The number of properties or elements.
Type
number