Skip to content

Callbag Pausable is a callbag that will convert any callbag stream into one that can be paused and resumed via data or talkback events. Thanks to erikras/callbag-pausable

License

Notifications You must be signed in to change notification settings

felixdrp/callbag-pause

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

callbag-pause

👜 Callbag Pause is a Callbag 👜 that will convert any callbag stream into one that can be paused and resumed via an external variable.

Many thanks to André Staltz (staltz) for Callbag 👜 and to Erik Rasmussen (erikras) for callbag-pausable ⏯️

usage example

You can run the example by:

npm intall callbag-pause
npm run example
import interval from 'callbag-interval'
import subscribe from 'callbag-subscribe'
import take from 'callbag-take'
import pipe from 'callbag-pipe'
import pause from './'

let pause = false

pipe(
    interval(100),
    pausable(() => pause),
    take(6),
    subscribe(console.log)
)

setTimeout(() => {
  console.log('PAUSING')
  pause = true
}, 400)
setTimeout(() => {
  console.log('RESUMING')
  pause = false
}, 1000)

/*
Result:
    0
    1
    2
    PAUSING
    RESUMING
    9
    10
    11
*/

About

Callbag Pausable is a callbag that will convert any callbag stream into one that can be paused and resumed via data or talkback events. Thanks to erikras/callbag-pausable

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published