Skip to content

Instantly share code, notes, and snippets.

phillmac / iterable_weak_map.js
Last active Jun 24, 2020 — forked from seanlinsley/iterable_weak_set.js
Iterable WeakSet in JavaScript
View iterable_weak_map.js
// spec:
// the spec contains an [iterable WeakMap implementation](
// NOTE: this WeakSet implementation is incomplete, only does what I needed
// In Firefox Nightly, visit about:config and enable javascript.options.experimental.weakrefs
class IterableWeakMap extends Map {
set(k, v) {
super.set(new WeakRef(k), v)
forEach(fn) {