implement .clone, .slice, and yxml.get

This commit is contained in:
Kevin Jahns
2020-11-08 01:51:39 +01:00
parent 86f7631d1e
commit 53f2344017
10 changed files with 202 additions and 1 deletions

View File

@@ -84,6 +84,17 @@ export class YMap extends AbstractType {
return new YMap()
}
/**
* @return {YMap<T>}
*/
clone () {
const map = new YMap()
this.forEach((value, key) => {
map.set(key, value instanceof AbstractType ? value.clone() : value)
})
return map
}
/**
* Creates YMapEvent and calls observers.
*