Use `WeakMap` to store `MessageChannel`
We use `Window` objects as keys on a map. Windows can be removed. `WeakMap` has the characteristic that keys that are claimed by the garbage collector are removed from the map. In this way, we are memory friendly and don't retain any defunct object.
Showing
Please register or sign in to comment