Methods
super(key, callArgsopt) → {*|null}
Walks up the parent class chain and looks for a class member called key in any of the parent classes this class inherits from. Returns the member value of the superclass or calls the member as a function and returns its return value when the optional callArgs array is given.
This function has two signatures and is sensitive to the amount of arguments passed to it:
super('key')- Returns the value ofkeywhen found within one of the parent classes.super('key', ['arg1', 'arg2'])- Calls thekey()method with parametersarg1andarg2when found within one of the parent classes.
| Name | Type | Attributes | Description |
|---|---|---|---|
key | string | The name of the superclass member to retrieve. | |
callArgs | * | | <optional> | Arguments to pass when invoking the superclass method. May be either an argument array or variadic arguments. |
Throws a
ReferenceErrorwhencallArgsare specified and the found member named bykeyis not a function value.- Type
- ReferenceError
Returns the value of the found member or the return value of the call to the found method. Returns null when no member was found in the parent class chain or when the call to the superclass method returned null.
- Type:
- * |
null
toString() → {string}
Returns a string representation of this class.
Returns a string representation of this class containing the constructor functions displayName and describing the class members and their respective types.
- Type:
- string
varargs(args, offset, …extra_argsopt) → {Array.<*>}
Extract all values from the given argument array beginning from offset and prepend any further given optional parameters to the beginning of the resulting array copy.
| Name | Type | Attributes | Description |
|---|---|---|---|
args | Array.<*> | The array to extract the values from. | |
offset | number | The offset from which to extract the values. An offset of | |
extra_args | * | <optional> <repeatable> | Extra arguments to add to prepend to the resulting array. |
Returns a new array consisting of the optional extra arguments and the values extracted from the args array beginning with offset.
- Type:
- Array.<*>
(static) extend(properties) → {LuCI.baseclass}
Extends this base class with the properties described in properties and returns a new subclassed Class instance
| Name | Type | Description |
|---|---|---|
properties | Object.<string, *> | An object describing the properties to add to the new subclass. |
Returns a new LuCI.baseclass subclassed from this class, extended by the given properties and with its prototype set to this base class to enable inheritance. The resulting value represents a class constructor and can be instantiated with new.
- Type:
- LuCI.
baseclass
(static) instantiate(args) → {LuCI.baseclass}
Calls the class constructor using new with the given argument array being passed as variadic parameters to the constructor.
| Name | Type | Description |
|---|---|---|
args | Array.<*> | An array of arbitrary values which will be passed as arguments to the constructor function. |
Returns a new LuCI.baseclass instance extended by the given properties with its prototype set to this base class to enable inheritance.
- Type:
- LuCI.
baseclass
(static) isSubclass(classValue) → {boolean}
Checks whether the given class value is a subclass of this class.
| Name | Type | Description |
|---|---|---|
classValue | LuCI. | The class object to test. |
Returns true when the given classValue is a subclass of this class or false if the given value is not a valid class or not a subclass of this class.
- Type:
- boolean
(static) singleton(properties, …new_args) → {LuCI.baseclass}
Extends this base class with the properties described in properties, instantiates the resulting subclass using the given arguments passed to this function and returns the resulting subclassed Class instance.
This function serves as a convenience shortcut for Class.extend() and subsequent new.
| Name | Type | Attributes | Description |
|---|---|---|---|
properties | Object.<string, *> | An object describing the properties to add to the new subclass. | |
new_args | * | <repeatable> | Arguments forwarded to the constructor of the generated subclass. |
Returns a new LuCI.baseclass instance extended by the given properties with its prototype set to this base class to enable inheritance.
- Type:
- LuCI.
baseclass