require(["liaison/ObservableArray"], function (ObservableArray) {
new ObservableArray(args);
});
An observable array, working as a shim of ECMAScript Harmony Array.observe().
Parameters:
| Name | Type | Argument | Description |
|---|---|---|---|
args |
module:decor/ObservableArray~CtorArguments |
<optional> |
The length of the new array or the initial list of array elements. |
- Source:
Extends
Show inheritedMethods
-
<static> canObserve(a) → {boolean}
-
Parameters:
Name Type Description aArray The array to test.
- Source:
Returns:
true if o can be observed with ObservableArray.observe().
- Type
- boolean
-
<static> observe(observable, callback) → {Handle}
-
If the 1st argument is non-object or null.
Parameters:
Name Type Description observableObject The ObservableArray to observe.
callbackmodule:decor/Observable~ChangeCallback The change callback.
- Source:
Throws:
-
If the 1st argument is non-object or null.
- Type
- TypeError
Returns:
The handle to stop observing.
- Type
- Handle
-
<static> test(a) → {boolean}
-
Parameters:
Name Type Description aArray The array to test.
- Source:
Returns:
true if o is an instance of ObservableArray.
- Type
- boolean
-
set(name, value)
-
Sets a value. Automatically emits change record(s) compatible with Object.observe() if no ECMAScript setter is defined for the given property. If ECMAScript setter is defined for the given property, use Observable.getNotifier(observable).notify(changeRecord) to manually emit a change record.
Parameters:
Name Type Description namestring The property name.
valueThe property value.
- Inherited From:
- Source:
Returns:
The value set.
-
splice(index, removeCount, var_args) → {Array}
-
Adds and/or removes elements from an array and automatically emits a change record compatible with ECMAScript Harmony Array.observe().
Parameters:
Name Type Argument Description indexnumber Index at which to start changing the array.
removeCountnumber [An integer indicating the number of old array elements to remove.
var_argsAnything <optional>
<repeatable>
The elements to add to the array.
- Source:
Returns:
An array containing the removed elements.
- Type
- Array
Type Definitions
-
CtorArguments
-
The same argument list of Array, taking the length of the new array or the initial list of array elements.
Type:
- number | Anything
- Source: