-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
xuhongxin
committed
Oct 16, 2018
1 parent
38772f5
commit 1c27301
Showing
10 changed files
with
189 additions
and
134 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,9 @@ | ||
package main | ||
|
||
import ( | ||
"github.com/bytom-community/wasm/sdk" | ||
) | ||
import "github.com/bytom-community/wasm/sdk/js" | ||
|
||
func main() { | ||
done := make(chan struct{}, 0) | ||
sdk.Register() | ||
js.Register() | ||
<-done | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// +build !mini | ||
|
||
package js | ||
|
||
import ( | ||
"syscall/js" | ||
|
||
"github.com/bytom-community/wasm/sdk/standard" | ||
|
||
"github.com/bytom-community/wasm/sdk/base" | ||
) | ||
|
||
//RegisterFunc Register js func | ||
type RegisterFunc func(args []js.Value) | ||
|
||
var funcs map[string]RegisterFunc | ||
|
||
func init() { | ||
funcs = make(map[string]RegisterFunc) | ||
|
||
funcs["createKey"] = base.CreateKey | ||
funcs["resetKeyPassword"] = base.ResetKeyPassword | ||
funcs["createAccount"] = standard.CreateAccount | ||
funcs["createAccountReceiver"] = standard.CreateAccountReceiver | ||
funcs["signTransaction"] = standard.SignTransaction | ||
funcs["signTransaction1"] = base.SignTransaction1 | ||
} | ||
|
||
//Register Register func | ||
func Register() { | ||
jsFuncVal := js.Global().Get("AllFunc") | ||
for k, v := range funcs { | ||
call := js.NewCallback(v) | ||
jsFuncVal.Set(k, call) | ||
} | ||
setPrintMessage := js.Global().Get("setFuncOver") | ||
setPrintMessage.Invoke() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package lib | ||
|
||
import "syscall/js" | ||
|
||
//EndFunc end call go func | ||
func EndFunc(value js.Value) { | ||
value.Call("endFunc") | ||
} | ||
|
||
//IsEmpty js value check empty | ||
func IsEmpty(value string) bool { | ||
if value == "" || value == "undefined" { | ||
return true | ||
} | ||
return false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.