Add optional iterable param to Y.Map(), matching Map()

This commit is contained in:
Duane Johnson
2020-06-06 21:32:24 -06:00
parent fa58ce53cd
commit 868dd5f0a5
2 changed files with 39 additions and 2 deletions

View File

@@ -45,13 +45,23 @@ export class YMapEvent extends YEvent {
* @implements {Iterable<T>}
*/
export class YMap extends AbstractType {
constructor () {
/**
*
* @param {Iterable<readonly [string, any]>=} entries - an optional iterable to initialize the YMap
*/
constructor (entries) {
super()
/**
* @type {Map<string,any>?}
* @private
*/
this._prelimContent = new Map()
this._prelimContent = null
if (entries === undefined) {
this._prelimContent = new Map()
} else {
this._prelimContent = new Map(entries)
}
}
/**