StackGenVis: Alignment of Data, Algorithms, and Models for Stacking Ensemble Learning Using Performance Metrics
https://doi.org/10.1109/TVCG.2020.3030352
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
990 B
39 lines
990 B
let lastTime = 0;
|
|
let request;
|
|
let cancel;
|
|
|
|
function init(window) {
|
|
request = window.requestAnimationFrame;
|
|
cancel = window.cancelAnimationFrame;
|
|
|
|
if (!request) {
|
|
const vendors = ['ms', 'moz', 'webkit', 'o'];
|
|
|
|
for (const vendor of vendors) {
|
|
request = window[`${vendor}RequestAnimationFrame`];
|
|
cancel = window[`${vendor}CancelAnimationFrame`] || window[`${vendor}CancelRequestAnimationFrame`];
|
|
}
|
|
}
|
|
|
|
if (!request) {
|
|
request = callback => {
|
|
const currTime = Date.now();
|
|
const timeToCall = Math.max(0, 16 - (currTime - lastTime)); // eslint-disable-next-line standard/no-callback-literal
|
|
|
|
const token = setTimeout(() => {
|
|
callback(currTime + timeToCall);
|
|
}, timeToCall);
|
|
lastTime = currTime + timeToCall;
|
|
return token;
|
|
};
|
|
|
|
cancel = token => clearTimeout(token);
|
|
}
|
|
}
|
|
|
|
export default {
|
|
request: callback => request(callback),
|
|
cancel: token => cancel(token),
|
|
init
|
|
};
|
|
//# sourceMappingURL=raf.js.map
|