Andrea Giammarchi (2013-07-11T22:04:29.000Z)
domenic at domenicdenicola.com (2013-07-16T14:53:07.960Z)
trivial like ... 2 weak maps + a set for a single event ? ```javascript obj.on(evt, handler); ``` .. internals ... ```javascript // wm as private internal generic WeakMap if (!wm.has(obj)) { // creates related WeakMap wm.set(obj, new WeakMap); } if (!wm.get(obj).has(evt)) { wm.get(obj).set(evt, new Set); } wm.get(obj).get(evt).add(handler); ``` I have the feeling it's very true in JS world nobody ever thinks about RAM and GC ^_^ That said, it becomes over complicated for non concrete reason/use case if we have strings since AFAIK WeakMap does not accept strings as key. For all this time the event type as string has blocked like ... nobody ever ? I wonder again what's the benefit then to instantly over complicate an API at this stage instead of looking around what worked already for everyone. Maybe it's me not seeing the power of objects as events.