add Y.Array.from

This commit is contained in:
Jeremy Rose 2020-11-01 10:01:04 -08:00
parent 39803c1d11
commit 4c46ebfb45

View File

@ -53,6 +53,18 @@ export class YArray extends AbstractType {
this._searchMarker = []
}
/**
* Construct a new YArray containing the specified items.
* @template T
* @param {Array<T>} items
* @return {YArray<T>}
*/
static from(items) {
const a = new YArray()
a.push(items)
return a
}
/**
* Integrate this type into the Yjs instance.
*