Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unified js #176

Draft
wants to merge 11 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions js/validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,16 +97,16 @@ func normalizeInputWrapper() js.Func {
return jsonFunc
}

func exitWrapper(c chan bool) js.Func {
func exitWrapper(done chan bool) js.Func {
jsonFunc := js.FuncOf(func(this js.Value, args []js.Value) any {
c <- true
done <- true
return nil
})
return jsonFunc
}

func main() {
c := make(chan bool)
done := make(chan bool)
// validate
f := validateWrapper()
js.Global().Set("__AMF__validateCustomProfile", f)
Expand All @@ -120,7 +120,8 @@ func main() {
f = normalizeInputWrapper()
js.Global().Set("__AMF__normalizeInput", f)
// exit
f = exitWrapper(c)
f = exitWrapper(done)
js.Global().Set("__AMF__terminateValidator", f)
<-c
js.Global().Get("onWasmInitialized").Invoke()
<-done
}
6 changes: 0 additions & 6 deletions package-lock.json

This file was deleted.

6 changes: 3 additions & 3 deletions scripts/gen_js_package.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env bash
GOOS=js GOARCH=wasm go build -o wrappers/js/lib/main.wasm -ldflags "-s -w" js/validator.go
gzip -9 -v -c wrappers/js/lib/main.wasm > wrappers/js/lib/main.wasm.gz
rm wrappers/js/lib/main.wasm
GOOS=js GOARCH=wasm go build -o wrappers/js/assets/main.wasm -ldflags "-s -w" js/validator.go
gzip -9 -v -c wrappers/js/assets/main.wasm > wrappers/js/assets/main.wasm.gz
rm wrappers/js/assets/main.wasm
10 changes: 0 additions & 10 deletions wrappers/js-web/.npmignore

This file was deleted.

75 changes: 0 additions & 75 deletions wrappers/js-web/index.js

This file was deleted.

Loading