In the implementation, it's not a method but a field (.weaklyHeld). A
field suffices for the current implementation of Flapjax.
> Also, is the isDetached property the correct approach to allow for
> release of stream resources?
>
> Why not adding to receiverE as an optional parameter a finaliser
> function to be automatically invoked by flapjax when the stream is
> detached?
It's clear that there is a problem if you don't use weaklyHeld/
isDetached. However, there may be a range of possible definitions of
"correct behavior." The paper suggests one definition: primitive
event streams detached by a switchE/switchB should stop receiving DOM
events.
There are various approaches to implementing this behavior. Ours is
the simplest hack possible.
>
> If we have a streams that get detached and then no more events are
> passed through it there is no way of detecting that it has been
> detached and therefore to free the associated resources.
I'm not sure I follow. Right now, when a stream is detached, it is
unreachable both in JavaScript and the DOM, so it gets garbage-
collected.
Arjun
Yes, this is correct. We're aware of this particular memory leak. A
possible solution is to have back-references between nodes so that
isDetached propagates immediately. However, that may create more
memory leaks--I'm not certain.
Arjun