mirror of
https://github.com/Shopify/draggable.git
synced 2025-12-08 20:15:56 +00:00
38 lines
1002 B
TypeScript
38 lines
1002 B
TypeScript
import {REQUEST_ANIMATION_FRAME_TIMEOUT} from './helpers/environment';
|
|
|
|
declare global {
|
|
export interface Event {
|
|
stoppedPropagation: boolean;
|
|
}
|
|
}
|
|
|
|
window.requestAnimationFrame = (callback) => {
|
|
return setTimeout(callback, REQUEST_ANIMATION_FRAME_TIMEOUT);
|
|
};
|
|
|
|
window.cancelAnimationFrame = (id) => {
|
|
return clearTimeout(id);
|
|
};
|
|
|
|
Event.prototype.stopPropagation = (function (_super) {
|
|
return function (
|
|
this: Event,
|
|
...args: Parameters<typeof Event.prototype.stopPropagation>
|
|
) {
|
|
const returnValue = _super.call(this, ...args);
|
|
this.stoppedPropagation = true;
|
|
return returnValue;
|
|
};
|
|
})(Event.prototype.stopPropagation);
|
|
|
|
Event.prototype.stopImmediatePropagation = (function (_super) {
|
|
return function (
|
|
this: Event,
|
|
...args: Parameters<typeof Event.prototype.stopImmediatePropagation>
|
|
) {
|
|
const returnValue = _super.call(this, ...args);
|
|
this.stoppedPropagation = true;
|
|
return returnValue;
|
|
};
|
|
})(Event.prototype.stopImmediatePropagation);
|