Created
October 2, 2013 14:22
-
-
Save karlwestin/6794538 to your computer and use it in GitHub Desktop.
iOS7 fix for morpheus.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
| var matchingTimestamps; | |
| frame(function(timestamp) { | |
| // if we're using a high res timer, make sure timestamp is not the old epoch-based value. | |
| // http://updates.html5rocks.com/2012/05/requestAnimationFrame-API-now-with-sub-millisecond-precision | |
| // patch for https://github.com/ded/morpheus/issues/53 | |
| // check if timestamps are on the same scale and cache result | |
| var argument = timestamp > 1e12, | |
| getTime = now() > 1e12; | |
| matchingTimestamps = argument === getTime; | |
| }); | |
| function render(timestamp) { | |
| var i, count = children.length | |
| if (!matchingTimestamps) timestamp = now() | |
| for (i = count; i--;) { | |
| children[i](timestamp) | |
| } | |
| children.length && frame(render) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment