Officially drop IE9-10 support, pull out our hacks (#2296)

- I also fixed a bunch of related comments
- I had to polyfill `requestAnimationFrame` for Node
- Drive-by: run `eslint . --fix`
- Drive-by: update transpiling info in CONTRIBUTING.md
- Drive-by: we aren't the only ones going semicolon-free
This commit is contained in:
Isiah Meadows 2018-11-27 18:04:15 -05:00 committed by GitHub
parent a8473e63c9
commit 4a641092dc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 54 additions and 45 deletions

View file

@ -3,18 +3,13 @@
var coreRenderer = require("../render/render")
function throttle(callback) {
//60fps translates to 16.6ms, round it down since setTimeout requires int
var delay = 16
var last = 0, pending = null
var timeout = typeof requestAnimationFrame === "function" ? requestAnimationFrame : setTimeout
var pending = null
return function() {
var elapsed = Date.now() - last
if (pending === null) {
pending = timeout(function() {
pending = requestAnimationFrame(function() {
pending = null
callback()
last = Date.now()
}, delay - elapsed)
})
}
}
}

View file

@ -5,6 +5,19 @@ var domMock = require("../../test-utils/domMock")
var throttleMocker = require("../../test-utils/throttleMock")
var apiRedraw = require("../../api/redraw")
// Because Node doesn't have this.
if (typeof requestAnimationFrame !== "function") {
global.requestAnimationFrame = (function (delay, last) {
return function(callback) {
var elapsed = Date.now() - last
return setTimeout(function() {
callback()
last = Date.now()
}, delay - elapsed)
}
})(16, 0)
}
o.spec("redrawService", function() {
var root, redrawService, $document
o.beforeEach(function() {