missing file

This commit is contained in:
Anton Nesterov 2024-10-01 17:30:09 +02:00
parent d8264d72cf
commit 9f2b366044
No known key found for this signature in database
GPG key ID: 59121E8AE2851FB5
4 changed files with 22 additions and 2 deletions

Binary file not shown.

View file

@ -12,7 +12,7 @@ import (
) )
func InitStatExports(this js.Value, args []js.Value) interface{} { func InitStatExports(this js.Value, args []js.Value) interface{} {
exports := args[0] exports := js.Global().Get("Object").New()
exports.Set("Bhattacharyya", js.FuncOf(src.Bhattacharyya)) exports.Set("Bhattacharyya", js.FuncOf(src.Bhattacharyya))
exports.Set("BivariateMoment", js.FuncOf(src.BivariateMoment)) exports.Set("BivariateMoment", js.FuncOf(src.BivariateMoment))
exports.Set("ChiSquare", js.FuncOf(src.ChiSquare)) exports.Set("ChiSquare", js.FuncOf(src.ChiSquare))
@ -54,7 +54,7 @@ func InitStatExports(this js.Value, args []js.Value) interface{} {
exports.Set("StdScore", js.FuncOf(src.StdScore)) exports.Set("StdScore", js.FuncOf(src.StdScore))
exports.Set("TOC", js.FuncOf(src.TOC)) exports.Set("TOC", js.FuncOf(src.TOC))
exports.Set("Variance", js.FuncOf(src.Variance)) exports.Set("Variance", js.FuncOf(src.Variance))
return nil return exports
} }
func main() { func main() {

20
stat/mod.ts Normal file
View file

@ -0,0 +1,20 @@
import "../lib/wasm_tinygo.js";
import { Stat } from "./types.ts";
// @ts-expect-error: no types
const go = new Go();
const code =
await (await fetch(import.meta.url.replace("/mod.ts", "/mod.wasm")))
.arrayBuffer();
const wasmMmodule = await WebAssembly.instantiate(code, go.importObject);
const wasm = wasmMmodule.instance;
go.run(wasm);
// @ts-ignore: no types
const _exports = __InitStatExports() as Record<string, (...args: unknown[]) => unknown> & Stat;
export default _exports;

Binary file not shown.