Skip to content

Instantly share code, notes, and snippets.

@Willmo36
Created October 15, 2015 14:55
Show Gist options
  • Save Willmo36/2e6e5734854b5f23f777 to your computer and use it in GitHub Desktop.
Save Willmo36/2e6e5734854b5f23f777 to your computer and use it in GitHub Desktop.
count down with most.js
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