diff --git a/src/display/api.js b/src/display/api.js index d3a9d6362..5bdcc7c87 100644 --- a/src/display/api.js +++ b/src/display/api.js @@ -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); } }