Merge pull request #254 from nornagon/array-from

add Y.Array.from
This commit is contained in:
Kevin Jahns 2020-11-08 02:01:48 +01:00 committed by GitHub
commit 3dd843372f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -54,6 +54,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.
*