-
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
31 changed files
with
4,176 additions
and
2,134 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"name": "tiltak-wasm", | ||
"version": "0.0.5", | ||
"license": "GPL-3.0-only", | ||
"files": [ | ||
"tiltak_wasm_bg.wasm", | ||
"tiltak_wasm.js", | ||
"tiltak_wasm.d.ts" | ||
], | ||
"browser": "tiltak_wasm.js", | ||
"types": "tiltak_wasm.d.ts" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
importScripts("./tiltak_wasm.js"); | ||
|
||
const { start_engine } = wasm_bindgen; | ||
|
||
function init_wasm_in_worker() { | ||
return wasm_bindgen("./tiltak_wasm_bg.wasm").then(() => { | ||
const callback = start_engine((result) => { | ||
self.postMessage(result); | ||
}); | ||
|
||
callback("tei"); | ||
|
||
self.onmessage = ({ data }) => { | ||
callback(data); | ||
}; | ||
}); | ||
} | ||
|
||
init_wasm_in_worker(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
declare namespace wasm_bindgen { | ||
/* tslint:disable */ | ||
/* eslint-disable */ | ||
/** | ||
* Start the engine, which will run asynschronously in the background until it crashes | ||
* | ||
* @param {function(string): void} output_callback - Callback that receives tei output line by line | ||
* @return {function(string): void} - Send one line of tei input to the engine | ||
*/ | ||
export function start_engine(output_callback: Function): any; | ||
|
||
} | ||
|
||
declare type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module; | ||
|
||
declare interface InitOutput { | ||
readonly memory: WebAssembly.Memory; | ||
readonly start_engine: (a: number) => number; | ||
readonly __wbindgen_malloc: (a: number, b: number) => number; | ||
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number; | ||
readonly __wbindgen_export_2: WebAssembly.Table; | ||
readonly _dyn_core__ops__function__Fn__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h22cc4d5ac9747ad9: (a: number, b: number, c: number, d: number) => void; | ||
readonly _dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hd894afd280c5d257: (a: number, b: number, c: number) => void; | ||
readonly __wbindgen_free: (a: number, b: number, c: number) => void; | ||
readonly __wbindgen_exn_store: (a: number) => void; | ||
readonly wasm_bindgen__convert__closures__invoke2_mut__h035c2a7c04ebf686: (a: number, b: number, c: number, d: number) => void; | ||
} | ||
|
||
/** | ||
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and | ||
* for everything else, calls `WebAssembly.instantiate` directly. | ||
* | ||
* @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated. | ||
* | ||
* @returns {Promise<InitOutput>} | ||
*/ | ||
declare function wasm_bindgen (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>; |
Oops, something went wrong.