aboutsummaryrefslogtreecommitdiffstats
path: root/ethereum/javascript_console.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-05-19 22:32:45 +0800
committerobscuren <geffobscura@gmail.com>2014-05-19 22:32:45 +0800
commit017bbbb582b09a3264b4ff996f35275d381f284f (patch)
treeb11fba658b414029b78958ddb6137634e7ccf966 /ethereum/javascript_console.go
parent16421106d47efb65331ed9f0499f12038158cbf1 (diff)
downloaddexon-017bbbb582b09a3264b4ff996f35275d381f284f.tar.gz
dexon-017bbbb582b09a3264b4ff996f35275d381f284f.tar.zst
dexon-017bbbb582b09a3264b4ff996f35275d381f284f.zip
Improved REPL output
Diffstat (limited to 'ethereum/javascript_console.go')
-rw-r--r--ethereum/javascript_console.go10
1 files changed, 9 insertions, 1 deletions
diff --git a/ethereum/javascript_console.go b/ethereum/javascript_console.go
index 1e1ae0e48..07d69dafc 100644
--- a/ethereum/javascript_console.go
+++ b/ethereum/javascript_console.go
@@ -11,6 +11,7 @@ import (
type Repl interface {
Start()
+ Stop()
}
type JSRE struct {
@@ -36,6 +37,9 @@ func NewJSRE(ethereum *eth.Ethereum) *JSRE {
make(map[string][]otto.Value),
}
+ // Init the JS lib
+ re.vm.Run(jsLib)
+
// We have to make sure that, whoever calls this, calls "Stop"
go re.mainLoop()
@@ -113,6 +117,10 @@ func (self *JSRepl) Start() {
self.read()
}
+func (self *JSRepl) Stop() {
+ self.re.Stop()
+}
+
func (self *JSRepl) parseInput(code string) {
defer func() {
if r := recover(); r != nil {
@@ -126,7 +134,7 @@ func (self *JSRepl) parseInput(code string) {
return
}
- fmt.Println(value)
+ self.PrintValue(value)
}
// The JSEthereum object attempts to wrap the PEthereum object and returns