I realize this is not supported across all our current browser targets
(and, as long as IE11 is part of that I can feel confident that it never
will be), but just in case anyone was not yet aware, real weak references
became available on Edge, Chrome and Firefox in the last month or two.

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakRef
https://caniuse.com/#feat=mdn-javascript_builtins_weakref

This feature should be able to support things like emulating flash
Dictionary with weak keys that are iterable (that is not possible with
WeakMap alone, for example, but could be emulated I think with a regular
Map with 'WeakRef' keys, probably coupled with a WeakMap) or even adding
support for weak event listeners by enhancing/wrapping the goog EventTarget
code.

Just sharing in case others are not aware... I did not use this yet myself.

Reply via email to