コード例 #1
0
func (self *HtmlApplication) Messages(messages ethstate.Messages, id string) {
	var msgs []javascript.JSMessage
	for _, m := range messages {
		msgs = append(msgs, javascript.NewJSMessage(m))
	}

	b, _ := json.Marshal(msgs)

	self.webView.Call("onWatchedCb", string(b), id)
}
コード例 #2
0
ファイル: ext_app.go プロジェクト: JosephGoulden/go-ethereum
func (self *ExtApplication) GetMessages(object map[string]interface{}) string {
	filter := ethchain.NewFilterFromMap(object, self.eth)

	messages := filter.Find()
	var msgs []javascript.JSMessage
	for _, m := range messages {
		msgs = append(msgs, javascript.NewJSMessage(m))
	}

	b, err := json.Marshal(msgs)
	if err != nil {
		return "{\"error\":" + err.Error() + "}"
	}

	return string(b)
}