add version call
This commit is contained in:
parent
6016c7e6d9
commit
4550117025
1 changed files with 6 additions and 0 deletions
|
|
@ -17,6 +17,7 @@ import (
|
||||||
"oss.terrastruct.com/d2/d2oracle"
|
"oss.terrastruct.com/d2/d2oracle"
|
||||||
"oss.terrastruct.com/d2/d2parser"
|
"oss.terrastruct.com/d2/d2parser"
|
||||||
"oss.terrastruct.com/d2/lib/urlenc"
|
"oss.terrastruct.com/d2/lib/urlenc"
|
||||||
|
"oss.terrastruct.com/d2/lib/version"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
@ -27,6 +28,7 @@ func main() {
|
||||||
js.Global().Set("d2Parse", js.FuncOf(jsParse))
|
js.Global().Set("d2Parse", js.FuncOf(jsParse))
|
||||||
js.Global().Set("d2Encode", js.FuncOf(jsEncode))
|
js.Global().Set("d2Encode", js.FuncOf(jsEncode))
|
||||||
js.Global().Set("d2Decode", js.FuncOf(jsDecode))
|
js.Global().Set("d2Decode", js.FuncOf(jsDecode))
|
||||||
|
js.Global().Set("d2Version", js.FuncOf(jsVersion))
|
||||||
initCallback := js.Global().Get("onWasmInitialized")
|
initCallback := js.Global().Get("onWasmInitialized")
|
||||||
if !initCallback.IsUndefined() {
|
if !initCallback.IsUndefined() {
|
||||||
initCallback.Invoke()
|
initCallback.Invoke()
|
||||||
|
|
@ -310,3 +312,7 @@ func jsDecode(this js.Value, args []js.Value) interface{} {
|
||||||
str, _ := json.Marshal(ret)
|
str, _ := json.Marshal(ret)
|
||||||
return string(str)
|
return string(str)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func jsVersion(this js.Value, args []js.Value) interface{} {
|
||||||
|
return version.Version
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue