mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-22 16:18:08 +02:00
Inlude the JS actions
for the page when dispatching the "pageopen"-event in the BaseViewer
Note first of all how the `PDFDocumentProxy.getJSActions` method in the API caches the result, which makes repeated lookups cheap enough to not really be an issue. Secondly, with the previous patch, we're now only dispatching "pageopen"/"pageclose"-events when there's actually a sandbox that listens for them. All-in-all, with these changes we can thus simplify the default-viewer "pageopen"-event handler a fair bit.
This commit is contained in:
parent
a882a85446
commit
13742eb82d
3 changed files with 16 additions and 23 deletions
|
@ -1140,12 +1140,9 @@ class PDFPageProxy {
|
|||
* {Object} with JS actions.
|
||||
*/
|
||||
getJSActions() {
|
||||
if (!this._jsActionsPromise) {
|
||||
this._jsActionsPromise = this._transport.getPageJSActions(
|
||||
this._pageIndex
|
||||
);
|
||||
}
|
||||
return this._jsActionsPromise;
|
||||
return (this._jsActionsPromise ||= this._transport.getPageJSActions(
|
||||
this._pageIndex
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue