Merge pull request #13004 from Snuffleupagus/cancelBound

Add a `this`-bound method for `InternalRenderTask.cancel`
This commit is contained in:
Tim van der Meij 2021-02-20 18:50:31 +01:00 committed by GitHub
commit 2194fb940d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2903,6 +2903,7 @@ const InternalRenderTask = (function InternalRenderTaskClosure() {
this.capability = createPromiseCapability();
this.task = new RenderTask(this);
// caching this-bound methods
this._cancelBound = this.cancel.bind(this);
this._continueBound = this._continue.bind(this);
this._scheduleNextBound = this._scheduleNext.bind(this);
this._nextBound = this._next.bind(this);
@ -3017,10 +3018,10 @@ const InternalRenderTask = (function InternalRenderTaskClosure() {
_scheduleNext() {
if (this._useRequestAnimationFrame) {
window.requestAnimationFrame(() => {
this._nextBound().catch(this.cancel.bind(this));
this._nextBound().catch(this._cancelBound);
});
} else {
Promise.resolve().then(this._nextBound).catch(this.cancel.bind(this));
Promise.resolve().then(this._nextBound).catch(this._cancelBound);
}
}