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) }
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) }