efficient initialization

pull/10803/head
Rich Harris 2 years ago
parent ed48773baa
commit 5c8b47ddfb

@ -23,9 +23,14 @@ export class ReactiveMap extends Map {
if (DEV) new Map(value); if (DEV) new Map(value);
if (value) { if (value) {
var sources = this.#sources;
for (var [key, v] of value) { for (var [key, v] of value) {
this.set(key, v); sources.set(key, source(v));
super.set(key, v);
} }
this.#size.v = sources.size;
} }
} }

Loading…
Cancel
Save