GenericFields

This commit is contained in:
Felix Kaspar
2024-02-25 20:55:48 +01:00
parent 20f027bb5a
commit 13bfa0b0d0
13 changed files with 173 additions and 28 deletions

View File

@@ -1,6 +1,6 @@
export interface Action {
values: any;
type: string;
type: "wait" | "done" | "impose" | string;
actions?: Action[];
}

View File

@@ -1,3 +1,4 @@
import { PdfFile } from "wrappers/PdfFile";
import { Action } from "../../declarations/Action";
import Joi from "@stirling-tools/joi";
@@ -33,7 +34,7 @@ export class Operator {
this.actionValues = action.values;
}
async run(input: any[], progressCallback: (progress: Progress) => void): Promise<any[]> {
async run(input: PdfFile[] | any[], progressCallback: (progress: Progress) => void): Promise<PdfFile[] | any[]> {
return [];
}
}

View File

@@ -1,4 +1,5 @@
// imports browserfs via index.html script-tag
import wasmUrl from '../../../public/wasm/pdfcpu/pdfcpu.wasm?url'
let wasmLocation = "/wasm/pdfcpu/";
@@ -29,15 +30,12 @@ function configureFs() {
}
function loadWasm() {
const script = document.createElement("script");
script.src = wasmLocation + "/wasm_exec.js";
script.async = true;
document.body.appendChild(script);
import("./wasm_exec.js");
}
const runWasm = async (param) => {
if (window.cachedWasmResponse === undefined) {
const response = await fetch(wasmLocation + "/pdfcpu.wasm");
const response = await fetch(wasmUrl);
const buffer = await response.arrayBuffer();
window.cachedWasmResponse = buffer;
window.go = new Go();