diff --git a/src/types/YArray.js b/src/types/YArray.js index e5991750..43413026 100644 --- a/src/types/YArray.js +++ b/src/types/YArray.js @@ -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. *