question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

End stream after $ element have been removed

See original GitHub issue

Wouldn’t it be nice to end stream obtained from $el.asEventStream method after $el have been removed?

Not sure I’m undersood your code right but check this:

Bacon.$.asEventStream = (eventName, selector, eventTransformer) ->
[eventTransformer, selector] = [selector, undefined] if isFunction(selector)
    withDescription(@selector or this, "asEventStream", eventName, Bacon.fromBinder (handler) =>
        @on('remove', -> handler new Bacon.End)
        @on(eventName, selector, handler)
        => @off(eventName, selector, handler)
    , eventTransformer)

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:14 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
mkaemmerercommented, Dec 27, 2014

Also, while this might be convenient for the cases where you do want to end the stream on removal, it’s only marginally more code to write it explicitly yourself:

$foo.asEventStream('click').takeUntil($foo.asEventStream('remove'))
0reactions
djskinnercommented, Jul 14, 2015

Yeah when put like that it makes a lot of sense. Thanks @johannhof .

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to remove the last element from a Stream Collection ...
This loop iterates over the images and removes an image as soon as a more recent matching object has been found, without the...
Read more >
Operating on and Removing an Item from Stream | Baeldung
Learn about the various ways in which we can operate on an item in a Java 8 Stream and then remove it once...
Read more >
Remove all elements after a certain element from a stream in ...
I want to remove all elements after a certain element from a stream in java. So for example if the list is this...
Read more >
Stream (Java Platform SE 8 ) - Oracle Help Center
Streams have a BaseStream. close() method and implement AutoCloseable , but nearly all stream instances do not actually need to be closed after...
Read more >
Audio and Video Delivery - Developer guides - MDN Web Docs
For further info see <video> element and Creating a cross-browser video ... alert('There has been a problem retrieving the streams - are you ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found