Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张蕾
Geth-Modification
Commits
307fe4a3
Commit
307fe4a3
authored
Jun 04, 2014
by
Maran
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add loading of extra build in js files to JS-Repl. Implements #67
parent
3755616a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
0 deletions
+19
-0
javascript_runtime.go
ethereum/javascript_runtime.go
+19
-0
No files found.
ethereum/javascript_runtime.go
View file @
307fe4a3
...
...
@@ -10,6 +10,7 @@ import (
"github.com/obscuren/otto"
"io/ioutil"
"os"
"path"
"path/filepath"
)
...
...
@@ -25,6 +26,20 @@ type JSRE struct {
objectCb
map
[
string
][]
otto
.
Value
}
func
(
jsre
*
JSRE
)
LoadExtFile
(
path
string
)
{
result
,
err
:=
ioutil
.
ReadFile
(
path
)
if
err
==
nil
{
jsre
.
vm
.
Run
(
result
)
}
else
{
ethutil
.
Config
.
Log
.
Debugln
(
"Could not load file:"
,
path
)
}
}
func
(
jsre
*
JSRE
)
LoadIntFile
(
file
string
)
{
assetPath
:=
path
.
Join
(
os
.
Getenv
(
"GOPATH"
),
"src"
,
"github.com"
,
"ethereum"
,
"go-ethereum"
,
"ethereal"
,
"assets"
,
"ext"
)
jsre
.
LoadExtFile
(
path
.
Join
(
assetPath
,
file
))
}
func
NewJSRE
(
ethereum
*
eth
.
Ethereum
)
*
JSRE
{
re
:=
&
JSRE
{
ethereum
,
...
...
@@ -39,6 +54,10 @@ func NewJSRE(ethereum *eth.Ethereum) *JSRE {
// Init the JS lib
re
.
vm
.
Run
(
jsLib
)
// Load extra javascript files
re
.
LoadIntFile
(
"string.js"
)
re
.
LoadIntFile
(
"big.js"
)
// We have to make sure that, whoever calls this, calls "Stop"
go
re
.
mainLoop
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment