aboutsummaryrefslogtreecommitdiffstats
path: root/ethereum/javascript_console.go
diff options
context:
space:
mode:
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