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.

holdWhen and pausable streams

See original GitHub issue

Hello! Recently, I decided to use holdWhen method in production code for making a pauseable stream (Bacon.repeatedly-based sequence), and, sadly, encountered a trouble that source stream releases lots of values which were buffered when it was ‘paused’. The behaviour I expected was just resuming the sequence from the pause point , without firing lots of buffered values. An example below:

# 'pauser' property
pauseP = $stopper.asEventStream("click").scan(true, (a,b) -> b = !a)
# image sequence
images = $container.find("img").get()
Bacon.repeatedly(100, images)
.holdWhen(pauseP.not())
.assign reloadImage

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
phadejcommented, Feb 28, 2014

shouldn’t it be

pauseP = $stopper.asEventStream("click").scan(true, (a,b) -> b == !a) # comparison, not assignment

or if it just inverting than just

pauseP = $stopper.asEventStream("click").scan(true, (a,b) -> !a)

But to answer your question, do you want filter?

pauseP: f-------t---f---
trig  : -1-2-3-4-5-6-7-8-
result: -1-2-3-4-----7-8--

with holdWhen you get

pauseP: f-------t---f---
trig  : -1-2-3-4-5-6-7-8-
result: -1-2-3-4----#7-8--, # is 5 and 6

or do you want:

pauseP: f-------t---f---
trig  : -1-2-3-4-5-6-7-8-
result: -1-2-3-4----5-6-7-8--,
0reactions
raimohanskacommented, May 22, 2014

Well, I just merged #324 so you’ve got bufferingThrottle and holdWhen. Enjoy bacon.js 0.7.13!

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to pause and resume streams periodically - Kafka Streams
Hi I have a question. I have 2 topics. I want to periodically transfer a message from one topic to another. For example...
Read more >
dominictarr/pause-stream - GitHub
This is a Stream that will strictly buffer when paused. Connect it to anything you need buffered. var ps = require('pause-stream')(); ...
Read more >
Samsung Galaxy - How To Place Calls On Hold - YouTube
Learn how to place people on hold when you need to stop talking to ... When you are on a call, tap the...
Read more >
Pause a stream | Datastream | Google Cloud
After starting a stream, you can pause it. When a stream is paused, Datastream won't pull any new data from the source database...
Read more >
Pause and resume Observable Stream and only emit custom ...
Yes, pause of receiving events or messages (or ignore them during the pause time), but only receive the second custom stream messages. – ......
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