-
Notifications
You must be signed in to change notification settings - Fork 46
Description
Hi,
This is a kind of RFC before going to PR.
In my fork I've now added a major under-the-hood update to MochiKit.Signal lib.
It uses WeakMap and Set to store references to signals to enable automatic GC.
Should also be faster due to less linear searches.
See: https://github.com/blq/mochikit/blob/master/MochiKit/Signal.js
All unit-tests pass except one, disconnectAllTo(function) since WeakMaps doesn't allow full iteration and I wanted to reduce WeakMaps to only source and dest objects, not functions.
Observe that this setup doesn't remove need to disconnect of course, WeakMaps only release fully GC:ed objects, it's not an out-of-your-scope release.
Another change in my fork is support for signal namespaces, similar to jQuery. That is a separate discussion I guess..
(WeakMap means IE10 is out, but code is written to still work in IE11 (no for-of loops or such))