func (self *JSRE) mainLoop() { // Subscribe to events reactor := self.ethereum.Reactor() reactor.Subscribe("newBlock", self.blockChan) out: for { select { case <-self.quitChan: break out case block := <-self.blockChan: if _, ok := block.Resource.(*ethchain.Block); ok { } case object := <-self.changeChan: if stateObject, ok := object.Resource.(*ethchain.StateObject); ok { for _, cb := range self.objectCb[ethutil.Bytes2Hex(stateObject.Address())] { val, _ := self.vm.ToValue(ethpub.NewPStateObject(stateObject)) cb.Call(cb, val) } } else if storageObject, ok := object.Resource.(*ethchain.StorageState); ok { for _, cb := range self.objectCb[ethutil.Bytes2Hex(storageObject.StateAddress)+ethutil.Bytes2Hex(storageObject.Address)] { val, _ := self.vm.ToValue(ethpub.NewPStorageState(storageObject)) cb.Call(cb, val) } } } } }
func (app *QmlApplication) ObjectChanged(stateObject *ethstate.StateObject) { app.win.Call("onObjectChangeCb", ethpub.NewPStateObject(stateObject)) }
func (app *HtmlApplication) ObjectChanged(stateObject *ethchain.StateObject) { app.webView.Call("onObjectChangeCb", ethpub.NewPStateObject(stateObject)) }