mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-22 16:18:08 +02:00
Add a this
-bound method for InternalRenderTask.cancel
This is similar to the other methods, and the only reason for this not having been done originally is that the `cancel` functionality is a later addition.
This commit is contained in:
parent
3d80c21a8e
commit
d69cf702f3
1 changed files with 3 additions and 2 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue