Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unsubscribe after model.apply #8

Open
also opened this issue Sep 7, 2014 · 1 comment
Open

unsubscribe after model.apply #8

also opened this issue Sep 7, 2014 · 1 comment

Comments

@also
Copy link

also commented Sep 7, 2014

I need to unsubscribe a model from a source added with model.apply.

The unplug function returned by bus.plug isn't returned (https://github.com/baconjs/bacon.model/blob/master/src/bacon.model.coffee#L47), so I can't see how to use the model without leaking memory.

@raimohanska
Copy link
Contributor

My idea is to add an end condition to the source instead. For instance

model.apply(changes.takeUntil(end))

Would this suit your needs? Bus will take care of cleaning up the references on End event, so you don't have to worry about memory.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants