Do I need to manually unsubscribe?

32 views
Skip to first unread message

ja...@jamesknelson.com

unread,
Feb 2, 2015, 5:05:24 AM2/2/15
to bac...@googlegroups.com
Thanks for writing Bacon.js, I'm really enjoying working with it!

Coming from AngularJS, I'm used to needing to manually call unsubscribe every time I watch something. I couldn't find an answer in the documentation, but would I be correct in assuming you don't need to manually unsubscribe after an End event is called? Say for example, I wouldn't need to unsubscribe for this?

Bacon.once(1).onValue (v) -> console.log v

Juha Paananen

unread,
Feb 2, 2015, 3:42:17 PM2/2/15
to ja...@jamesknelson.com, bac...@googlegroups.com
If you limit the stream smartly you dont need to unsub. I've never used explocit unsub myself. The stream will clean up automatically when it ends. You can use methods like .take(1) to make sure the stream ends.

-juha-
> --
> You received this message because you are subscribed to the Google Groups "Bacon.js" group.
> To post to this group, send email to bac...@googlegroups.com.
> Visit this group at http://groups.google.com/group/baconjs.
Reply all
Reply to author
Forward
0 new messages