missing file
This commit is contained in:
parent
d8264d72cf
commit
9f2b366044
BIN
regr/mod.wasm
BIN
regr/mod.wasm
Binary file not shown.
|
@ -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
20
stat/mod.ts
Normal 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;
|
BIN
stat/mod.wasm
BIN
stat/mod.wasm
Binary file not shown.
Loading…
Reference in a new issue