Created
December 21, 2013 20:08
-
-
Save rpominov/8074286 to your computer and use it in GitHub Desktop.
Bacon.js requestAnimationFrame
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
Bacon.fromBinder (sink) -> | |
request = | |
window.requestAnimationFrame or | |
window.webkitRequestAnimationFrame or | |
window.mozRequestAnimationFrame or | |
window.oRequestAnimationFrame or | |
window.msRequestAnimationFrame or | |
(f) -> window.setTimeout(f, 1000 / 60) | |
subscribed = true | |
handler = -> | |
if subscribed | |
sink() | |
request handler | |
request handler | |
-> | |
subscribed = false |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment