diff --git a/src/types/YArray.js b/src/types/YArray.js index b0f78fdb..d1f2e7ed 100644 --- a/src/types/YArray.js +++ b/src/types/YArray.js @@ -53,6 +53,18 @@ export class YArray extends AbstractType { this._searchMarker = [] } + /** + * Construct a new YArray containing the specified items. + * @template T + * @param {Array} items + * @return {YArray} + */ + static from(items) { + const a = new YArray() + a.push(items) + return a + } + /** * Integrate this type into the Yjs instance. *