JS -- Add listener for sandbox events only if there are some actions

* When no actions then set it to null instead of empty object
* Even if a field has no actions, it needs to listen to events from the sandbox in order to be updated if an action changes something in it.
This commit is contained in:
Calixte Denizet 2020-10-28 19:16:56 +01:00
parent 55f55f5859
commit a5279897a7
13 changed files with 170 additions and 28 deletions

View file

@ -903,6 +903,14 @@ class PDFDocumentProxy {
return this._transport.getFieldObjects();
}
/**
* @returns {Promise<boolean>} A promise that is resolved with `true`
* if some /AcroForm fields have JavaScript actions.
*/
hasJSActions() {
return this._transport.hasJSActions();
}
/**
* @returns {Promise<Array<string> | null>} A promise that is resolved with an
* {Array<string>} containing IDs of annotations that have a calculation
@ -2568,6 +2576,10 @@ class WorkerTransport {
return this.messageHandler.sendWithPromise("GetFieldObjects", null);
}
hasJSActions() {
return this.messageHandler.sendWithPromise("HasJSActions", null);
}
getCalculationOrderIds() {
return this.messageHandler.sendWithPromise("GetCalculationOrderIds", null);
}