From: Arik Sosman Date: Sat, 16 Jan 2021 09:48:29 +0000 (-0800) Subject: add node wasm import to bindings X-Git-Tag: v0.0.1~45 X-Git-Url: http://git.bitcoin.ninja/index.cgi?p=ldk-java;a=commitdiff_plain;h=68437301d6d8209c09c7df0b1d11999ca77665d2 add node wasm import to bindings --- diff --git a/typescript_strings.py b/typescript_strings.py index 6ef153a4..5c1a36d5 100644 --- a/typescript_strings.py +++ b/typescript_strings.py @@ -22,6 +22,18 @@ class Consts: ) self.bindings_header = """ + +const path = require('path').join(__dirname, 'bindings.wasm'); +const bytes = require('fs').readFileSync(path); +let imports = {}; +// add all exports to dictionary and move down? +// use `module.exports`? +// imports['./bindings.js'] = require('./bindings.js'); + +const wasmModule = new WebAssembly.Module(bytes); +const wasmInstance = new WebAssembly.Instance(wasmModule, imports); +// module.exports = wasmInstance.exports; +const wasm = wasmInstance.exports; export class VecOrSliceDef { public dataptr: number;