main
Last change
on this file was d565449, checked in by stefan toskovski <stefantoska84@…>, 6 months ago |
Update repo after prototype presentation
|
-
Property mode
set to
100644
|
File size:
635 bytes
|
Rev | Line | |
---|
[d565449] | 1 | import global from './global.js';
|
---|
| 2 |
|
---|
| 3 | /**
|
---|
| 4 | * A shim for the requestAnimationFrame which falls back to the setTimeout if
|
---|
| 5 | * first one is not supported.
|
---|
| 6 | *
|
---|
| 7 | * @returns {number} Requests' identifier.
|
---|
| 8 | */
|
---|
| 9 | export default (() => {
|
---|
| 10 | if (typeof requestAnimationFrame === 'function') {
|
---|
| 11 | // It's required to use a bounded function because IE sometimes throws
|
---|
| 12 | // an "Invalid calling object" error if rAF is invoked without the global
|
---|
| 13 | // object on the left hand side.
|
---|
| 14 | return requestAnimationFrame.bind(global);
|
---|
| 15 | }
|
---|
| 16 |
|
---|
| 17 | return callback => setTimeout(() => callback(Date.now()), 1000 / 60);
|
---|
| 18 | })();
|
---|
Note:
See
TracBrowser
for help on using the repository browser.