Skip to content

Commit

Permalink
Add a requestAnimationFrame polyfill
Browse files Browse the repository at this point in the history
  • Loading branch information
rreusser committed Sep 6, 2016
1 parent f07a274 commit d87a468
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
13 changes: 3 additions & 10 deletions src/components/rangeslider/create_slider.js
Original file line number Diff line number Diff line change
Expand Up @@ -221,16 +221,9 @@ module.exports = function createSlider(gd) {
}

function setDataRange(dataMin, dataMax) {

if(window.requestAnimationFrame) {
window.requestAnimationFrame(function() {
Plotly.relayout(gd, 'xaxis.range', [dataMin, dataMax]);
});
} else {
setTimeout(function() {
Plotly.relayout(gd, 'xaxis.range', [dataMin, dataMax]);
}, 16);
}
window.requestAnimationFrame(function() {
Plotly.relayout(gd, 'xaxis.range', [dataMin, dataMax]);
});
}


Expand Down
1 change: 1 addition & 0 deletions tasks/stats.js
Original file line number Diff line number Diff line change
Expand Up @@ -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>',
'```',
'',
'before the plotly.js script tag.',
Expand Down

0 comments on commit d87a468

Please sign in to comment.