-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a requestAnimationFrame polyfill #904
Conversation
@@ -13,6 +13,8 @@ var d3 = require('d3'); | |||
|
|||
var lib = module.exports = {}; | |||
|
|||
require('./request_animation_frame'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since raf
is already pretty well supported (ref http://caniuse.com/#feat=requestanimationframe), I'd vote for not including the polyfill in the plotly.js bundle by default.
I would move the request_animation_frame.js
to dist/extras
and add a line in the dist/
README.md generated here.
79576a3
to
d87a468
Compare
d87a468
to
57611e9
Compare
@@ -52,6 +52,7 @@ function getInfoContent() { | |||
'', | |||
'```html', | |||
'<script>if(typeof window.Int16Array !== \'function\')document.write("<scri"+"pt src=\'extras/typedarray.min.js\'></scr"+"ipt>");</script>', | |||
'<script>document.write("<scri"+"pt src=\'extras/request_animation_frame.js\'></scr"+"ipt>");</script>', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@etpinard Are two document.write
script tag insertions in series valid?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess I can't imagine any reason why it wouldn't be. Just not a pattern I ever really use.
Thanks for cleaning this up 💃 |
This PR adds a proper RAF polyfill based on this discussion and the resulting repo. I debated whether to make this
Lib.requestAnimationFrame
andLib.cancelAnimationFrame
or not. The only downside of this approach is that it would fix libraries usingrequestAnimationFrame
without a polyfill.As part of this, remove the logic from:
plotly.js/src/components/rangeslider/create_slider.js
Lines 225 to 233 in f07a274