Skip to content

Instantly share code, notes, and snippets.

@yelouafi
Created July 17, 2015 03:01
Show Gist options
  • Save yelouafi/9edf4125e95ccd4b107b to your computer and use it in GitHub Desktop.
Save yelouafi/9edf4125e95ccd4b107b to your computer and use it in GitHub Desktop.
// sequence of elements from an array that occur at a fixed interval
// starting after an initial delay
// yields 1, 2 and 3 each second starting after five seconds
Stream.seq([1,2,3], 5000, 1000)
//stream of DOM events that occur until a promise is completed
// receives click events for 10 seconds
Stream.fromDomEvent(document.body, 'click', delay(10000) )
// Node events can also be thought as (possibly infinite) streams
var server = http.createServer();
Stream.fromEmitter(server, 'request')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment