Last active
December 29, 2016 19:06
-
-
Save jsayol/fe64d027f908483b20e8e0e00f30ed81 to your computer and use it in GitHub Desktop.
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
const show$ = Observable.timer(0, 1000); | |
const hide$ = Observable.timer(750, 1000); | |
const blinker$ = Observable.merge( | |
show$.mapTo('showing'), | |
hide$.mapTo('hiding') | |
); | |
blinker$.subscribe(value => { | |
// Let's assume the "element" variable holds a reference to the | |
// element we want to show or hide. | |
if (value == 'showing') | |
element.style['visibility'] = 'visible'; | |
else if (value == 'hiding') | |
element.style['visibility'] = 'hidden'; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment