File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -20,6 +20,12 @@ require("./style.less");
20
20
// and across.
21
21
const MIN_HIGHLIGHT_SIZE = 25 ;
22
22
23
+ // Polyfill fallback for IE < 10
24
+ window . requestAnimationFrame = window . requestAnimationFrame ||
25
+ function ( callback ) {
26
+ window . setTimeout ( callback , 16 ) ;
27
+ } ;
28
+
23
29
module . exports = ( namespace ) => {
24
30
// The class that will be applied to any annotation generated in this
25
31
// namespace
@@ -65,15 +71,14 @@ module.exports = (namespace) => {
65
71
// Mount all annotations to the DOM in sequence. This is done by
66
72
// picking items off the queue, where each item consists of the
67
73
// annotation and the node to which we'll append it.
68
- function render ( ) {
74
+ ( function loop ( ) {
69
75
for ( let i = 0 ; queue . length > 0 && i < RENDER_CHUNK_SIZE ; i ++ ) {
70
76
let item = queue . shift ( ) ;
71
77
item . $parent . append ( item . $annotation ) ;
72
78
}
73
79
74
- window . requestAnimationFrame ( render ) ;
75
- }
76
- window . requestAnimationFrame ( render ) ;
80
+ window . requestAnimationFrame ( loop ) ;
81
+ } ) ( ) ;
77
82
78
83
// Handle resizes by repositioning all annotations in bulk
79
84
$ ( window ) . resize ( ( ) => {
You can’t perform that action at this time.
0 commit comments