diff --git a/Makefile b/Makefile index 657afc891a3ecac25d132c699a30cc3f0e459940..cd183023d09da89d457b2f7a4ec08d33ab75db15 100644 --- a/Makefile +++ b/Makefile @@ -32,6 +32,7 @@ binary: worker_binaries: GOOS=js GOARCH=wasm go build -ldflags '-w -s' -trimpath -o xxdk-channelsIndexedDkWorker.wasm ./indexedDb/impl/channels/... GOOS=js GOARCH=wasm go build -ldflags '-w -s' -trimpath -o xxdk-dmIndexedDkWorker.wasm ./indexedDb/impl/dm/... + GOOS=js GOARCH=wasm go build -ldflags '-w -s' -trimpath -o xxdk-stateIndexedDkWorker.wasm ./indexedDb/impl/state/... GOOS=js GOARCH=wasm go build -ldflags '-w -s' -trimpath -o xxdk-logFileWorker.wasm ./logging/workerThread/... binaries: binary worker_binaries diff --git a/indexedDb/impl/state/stateIndexedDbWorker.js b/indexedDb/impl/state/stateIndexedDbWorker.js new file mode 100644 index 0000000000000000000000000000000000000000..a7c440d2a862a81737d75418ef39e5464c99ad90 --- /dev/null +++ b/indexedDb/impl/state/stateIndexedDbWorker.js @@ -0,0 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// Copyright © 2022 xx foundation // +// // +// Use of this source code is governed by a license that can be found in the // +// LICENSE file. // +//////////////////////////////////////////////////////////////////////////////// + +importScripts('wasm_exec.js'); + +const isReady = new Promise((resolve) => { + self.onWasmInitialized = resolve; +}); + +const go = new Go(); +const binPath = 'xxdk-stateIndexedDkWorker.wasm' +WebAssembly.instantiateStreaming(fetch(binPath), go.importObject).then(async (result) => { + go.run(result.instance); + await isReady; +}).catch((err) => { + console.error(err); +}); \ No newline at end of file