![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
cellx-collections
Advanced tools
If you record to the cell an instance of class which inherits of `cellx.EventEmitter`, then the cell will subscribe to its `change` event and will claim it as own:
If you record to the cell an instance of class which inherits of cellx.EventEmitter
,
then the cell will subscribe to its change
event and will claim it as own:
let value = cellx(new cellx.EventEmitter());
value.subscribe((err, evt) => {
console.log(evt.target instanceof cellx.EventEmitter);
});
value().emit('change');
// => true
Due to this, you can create your collections, upon updating those collections you will update the cell containing them and dependent cells will be recalculated. Two such collections already is added to the cellx:
Example:
let map = new cellx.ObservableMap({
key1: 1,
key2: 2,
key3: 3
});
cellx.ObservableMap
repeats
Map from ECMAScript 2015,
except for the following differences:
cellx.EventEmitter
and generates an event change
when changing their records;clone
, which creates a copy of map;Example:
let list = new cellx.ObservableList([1, 2, 3]);
Like cellx.ObservableMap
, list generates an event change
upon any change of its records.
During initialization the list may take option itemComparator
, which will implement the assortment of its items:
let list = new cellx.ObservableList([
{ x: 5 },
{ x: 1 },
{ x: 10 }
], {
itemComparator: (a, b) => {
if (a.x < b.x) { return -1; }
if (a.x > b.x) { return 1; }
return 0;
}
});
console.log(list.toArray());
// => [{ x: 1 }, { x: 5 }, { x: 10 }]
list.addRange([{ x: 100 }, { x: -100 }, { x: 7 }]);
console.log(list.toArray());
// => [{ x: -100 }, { x: 1 }, { x: 5 }, { x: 7 }, { x: 10 }, { x: 100 }]
If instead of itemComparator
you pass the option sorted
with the value true
, it will use the standard itemComparator
:
let list = new cellx.ObservableList([5, 1, 10], { sorted: true });
console.log(list.toArray());
// => [1, 5, 10]
list.addRange([100, -100, 7]);
console.log(list.toArray());
// => [-100, 1, 5, 7, 10, 100]
Length of the list. Read-only.
Function for comparing items in the sorted list. Read-only.
Whether or not the list is sorted. Read-only.
Important difference between list and array is that the list can't contain so-called "holes"
that is, when it will try to read or set the item of the index beyond the existing range of indexes,
an exception will be generated.
Range extension (adding of items) occurs through methods add
, addRange
, insert
and insertRange
.
In such case, in the last two methods passed index
can not be longer than the length of the list.
Sorted list suggests that its items are always in sorted order. Methods
set
, setRange
, insert
and insertRange
are contrary to this statement, they either will break the correct order
of sorting or (for preservation of this order) will install/paste past the specified index, i.e.
will not work properly. Therefore, when you call the sorted list, they always generate an exception. It is possible to
add items to the sorted list through the methods add
and addRange
, or during initialization of the list.
Type signature: (item) -> boolean;
.
Checks if the item is in the list.
Type signature: (item, fromIndex?: int) -> int;
.
Type signature: (item, fromIndex?: int) -> int;
.
Type signature: (index: int) -> *;
.
Type signature: (index: int, count?: uint) -> Array;
.
If count
is unspecified it makes copies till the end of the list.
Type signature: (index: int, item) -> cellx.ObservableList;
.
Type signature: (index: int, items: Array) -> cellx.ObservableList;
.
Type signature: (item, unique?: boolean) -> cellx.ObservableList;
.
Type signature: (items: Array, uniques?: boolean) -> cellx.ObservableList;
.
Type signature: (index: int, item) -> cellx.ObservableList;
.
Type signature: (index: int, items: Array) -> cellx.ObservableList;
.
Type signature: (item, fromIndex?: int) -> boolean;
.
Removes the first occurrence of item
in the list.
Type signature: (item, fromIndex?: int) -> boolean;
.
It removes all occurrences of item
list.
Type signature: (index: int) -> *;
.
Type signature: (index: int, count?: uint) -> Array;
.
If count
is unspecified it will remove everything till the end of the list.
Type signature: (oldItem, newItem, fromIndex?: int) -> boolean;
.
Type signature: (oldItem, newItem, fromIndex?: int) -> boolean;
.
Type signature: () -> cellx.ObservableList;
.
Type signature: (separator?: string) -> string;
.
Type signature: (cb: (item, index: uint, list: cellx.ObservableList), context?);
.
Type signature: (cb: (item, index: uint, list: cellx.ObservableList) -> *, context?) -> Array;
.
Type signature: (cb: (item, index: uint, list: cellx.ObservableList) -> ?boolean, context?) -> Array;
.
Type signature: (cb: (item, index: uint, list: cellx.ObservableList) -> ?boolean, context?) -> boolean;
.
Type signature: (cb: (item, index: uint, list: cellx.ObservableList) -> ?boolean, context?) -> boolean;
.
Type signature: (cb: (accumulator, item, index: uint, list: cellx.ObservableList) -> *, initialValue?) -> *;
.
Type signature: (cb: (accumulator, item, index: uint, list: cellx.ObservableList) -> *, initialValue?) -> *;
.
Type signature: (cb: (item, index: uint, list: cellx.ObservableList) -> ?boolean, fromIndex?: int) -> *;
.
Type signature: (cb: (item, index: uint, list: cellx.ObservableList) -> ?boolean, fromIndex?: int) -> *;
.
Type signature: (cb: (item, index: uint, list: cellx.ObservableList) -> ?boolean, fromIndex?: int) -> int;
.
Type signature: (cb: (item, index: uint, list: cellx.ObservableList) -> ?boolean, fromIndex?: int) -> int;
.
Type signature: () -> cellx.ObservableList;
.
Type signature: () -> Array;
.
Type signature: () -> string;
.
FAQs
If you record to the cell an instance of class which inherits of `cellx.EventEmitter`, then the cell will subscribe to its `change` event and will claim it as own:
The npm package cellx-collections receives a total of 14 weekly downloads. As such, cellx-collections popularity was classified as not popular.
We found that cellx-collections demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.