Remove no-op onPull
/onCancel
streamSink callbacks from the "GetTextContent"-handler
The `MessageHandler`-implementation already handles either of these callbacks being undefined, hence there's no particular reason (as far as I can tell) to add no-op functions here. Also, in a couple of `MessageHandler`-methods, utilize an already existing local variable more.
This commit is contained in:
parent
f90f9466e3
commit
45ddb12f61
@ -737,8 +737,6 @@ class WorkerMessageHandler {
|
||||
|
||||
handler.on("GetTextContent", function wphExtractText(data, sink) {
|
||||
const pageIndex = data.pageIndex;
|
||||
sink.onPull = function (desiredSize) {};
|
||||
sink.onCancel = function (reason) {};
|
||||
|
||||
pdfManager.getPage(pageIndex).then(function (page) {
|
||||
const task = new WorkerTask("GetTextContent: page " + pageIndex);
|
||||
|
@ -448,7 +448,7 @@ class MessageHandler {
|
||||
}
|
||||
// Reset desiredSize property of sink on every pull.
|
||||
this.streamSinks[streamId].desiredSize = data.desiredSize;
|
||||
const { onPull } = this.streamSinks[data.streamId];
|
||||
const { onPull } = this.streamSinks[streamId];
|
||||
new Promise(function (resolve) {
|
||||
resolve(onPull && onPull());
|
||||
}).then(
|
||||
@ -518,7 +518,7 @@ class MessageHandler {
|
||||
if (!this.streamSinks[streamId]) {
|
||||
break;
|
||||
}
|
||||
const { onCancel } = this.streamSinks[data.streamId];
|
||||
const { onCancel } = this.streamSinks[streamId];
|
||||
new Promise(function (resolve) {
|
||||
resolve(onCancel && onCancel(wrapReason(data.reason)));
|
||||
}).then(
|
||||
|
Loading…
Reference in New Issue
Block a user