mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-08 17:30:09 +02:00
JS -- Fix events dispatchment and add tests
* dispatch event to take into account calculation order * use a map for actions in Field
This commit is contained in:
parent
83658c974d
commit
2dfac4cb41
7 changed files with 459 additions and 104 deletions
|
@ -22,7 +22,7 @@ import { ProxyHandler } from "./proxy.js";
|
|||
import { Util } from "./util.js";
|
||||
import { ZoomType } from "./constants.js";
|
||||
|
||||
function initSandbox(data, extra, out) {
|
||||
function initSandbox({ data, extra, out, testMode = false }) {
|
||||
const proxyHandler = new ProxyHandler(data.dispatchEventName);
|
||||
const { send, crackURL } = extra;
|
||||
const doc = new Doc({
|
||||
|
@ -58,6 +58,14 @@ function initSandbox(data, extra, out) {
|
|||
out[name] = aform[name].bind(aform);
|
||||
}
|
||||
}
|
||||
|
||||
if (
|
||||
(typeof PDFJSDev === "undefined" ||
|
||||
PDFJSDev.test("!PRODUCTION || TESTING")) &&
|
||||
testMode
|
||||
) {
|
||||
out._app = app;
|
||||
}
|
||||
}
|
||||
|
||||
export { initSandbox };
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue