Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
CodeApe committed Jul 23, 2024
0 parents commit df85183
Show file tree
Hide file tree
Showing 9 changed files with 855,430 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.idea
.vscode
.idea
39 changes: 39 additions & 0 deletions build_wasm.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
//go:build js && wasm

package wasmecdict

import (
"syscall/js"
)

const version = "0.0.1"

func lookUp(_ js.Value, args []js.Value) any {
if len(args) > 0 {
text := args[0].String()
res := LookUp(text)
if res != nil {
return js.ValueOf(res.toMap())
}
}
return js.Undefined()
}

func info(_ js.Value, _ []js.Value) any {
return map[string]interface{}{
"version": version,
"words": len(dictMapSingleton),
"lemmas": len(lemmaMapSingleton),
"author": "[email protected]",
"email": "[email protected]",
"DictionaryData": "https://github.com/skywind3000/ECDICT",
"License": "MIT",
}
}

func main() {
js.Global().Set("lookUp", js.FuncOf(lookUp)) //export window.lookUp to lookUp English word
js.Global().Set("ecDictionary", js.FuncOf(info)) // export ecDictionary show info
done := make(chan struct{}, 0)
<-done
}
770,612 changes: 770,612 additions & 0 deletions ecdict.csv

Large diffs are not rendered by default.

Loading

0 comments on commit df85183

Please sign in to comment.