Skip to content

Instantly share code, notes, and snippets.

@beber89
beber89 / node.go
Created September 24, 2019 10:56
mine-dapp-wasm/chainfabric/node/Connect
// Connect connects node to remote server via TCP
func (nd *Node) Connect() bool {
// connect to this socket
nd.ws = js.Global().Get("WebSocket").New(fmt.Sprintf("ws://%s:%d/ws", nd.toIP, nd.toPort))
nd.ws.Call("addEventListener", "open", js.FuncOf(func(this js.Value, args []js.Value) interface{} {
return nil
}))
nd.ws.Call("addEventListener", "message", js.FuncOf(func(this js.Value, args []js.Value) interface{} {
message := args[0].Get("data").String()
Verifying my Blockstack ID is secured with the address 1DkrieQuUHrV4WZdNYqi1nCk7NVgwhh5V6 https://explorer.blockstack.org/address/1DkrieQuUHrV4WZdNYqi1nCk7NVgwhh5V6
@beber89
beber89 / actions.go
Created September 16, 2019 22:03
web/actions.go - package web
func RegisterCallbacks() {
js.Global().Set("reward", js.FuncOf(reward))
js.Global().Set("buyCommodity", js.FuncOf(buyCommodity))
js.Global().Set("networth", js.FuncOf(networth))
js.Global().Set("changeUser", js.FuncOf(changeUser))
js.Global().Set("sendSliderValToWasm", js.FuncOf(sendSliderValToWasm))
}
var (
merchant string