Created
October 15, 2015 14:55
-
-
Save Willmo36/2e6e5734854b5f23f777 to your computer and use it in GitHub Desktop.
count down with most.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import most from 'most'; | |
const load$ = most.fromEvent('DOMContentLoaded', document); | |
const tick$ = load$.flatMap(() => { | |
return most.iterate((f) => f + 1, 0).take(5).flatMap(v => most.of(v).delay(v * 1000)); | |
}); | |
load$.observe(() => console.log('timer start')); | |
tick$.observe(x => console.log('timer tick', x)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment