Matthew Robb wrote:
With the introduction of custom elements I find myself more and more
interested in script that is tightly coupled to DOM nodes but that can
be safely spun down when that node is GC'd (not just lifecycle
"removed"). This could be achieved by having a callback on weakmaps or
some way to hook into the destruction phase of a dom element's
lifecycle ( this seems messier from an authoring standpoint ).
You've heard this before: we are not going to do pre-mortem
finalization. We are not doing post-mortem easily, in a way that
telegraphs fine-grained GC schedules.
Perhaps somewhere in the middle would work, something like a regular
map but that also pays attention to the ref count changes of key and
an author can hook in with a callback that effectively means "reached
1 ref".
"ref count"?
Engines use GC. True, GC and ref-counting have the same asymptotic
performance with cycles across all the generations, but engines are not
switching to ref-counting.
It sounds like weak listeners would be helpful, both in abstracting from
weak refs to avoid post-mortem finalization GC non-determinism leakage;
and in giving hints to the GC so it can be prompt.
But you ain't gonna get a callback on "zero refcount"!
/be
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss