draggable/scripts/test/environment.js
2018-03-02 16:51:31 -05:00

26 lines
718 B
JavaScript

const requestAnimationFrameTimeout = 15;
window.requestAnimationFrame = (callback) => {
return setTimeout(callback, requestAnimationFrameTimeout);
};
window.cancelAnimationFrame = (id) => {
return clearTimeout(id);
};
Event.prototype.stopPropagation = (function(_super) {
return function(...args) {
const returnValue = _super.call(this, ...args);
this.stoppedPropagation = true;
return returnValue;
};
})(Event.prototype.stopPropagation);
Event.prototype.stopImmediatePropagation = (function(_super) {
return function(...args) {
const returnValue = _super.call(this, ...args);
this.stoppedPropagation = true;
return returnValue;
};
})(Event.prototype.stopImmediatePropagation);