Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
baas-ide
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
guxukai
baas-ide
Commits
c2700c22
Commit
c2700c22
authored
Feb 28, 2018
by
yann300
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
execute batch in serie
parent
a93da3de
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
12 deletions
+25
-12
app.js
src/app.js
+25
-12
No files found.
src/app.js
View file @
c2700c22
...
...
@@ -358,48 +358,61 @@ Please make a backup of your contracts and start using http://remix.ethereum.org
and interpret them as commands
*/
var
cmdInterpreter
=
new
CommandInterpreter
()
cmdInterpreter
.
event
.
register
(
'debug'
,
(
hash
)
=>
{
cmdInterpreter
.
event
.
register
(
'debug'
,
(
hash
,
cb
)
=>
{
startdebugging
(
hash
)
if
(
cb
)
cb
()
})
cmdInterpreter
.
event
.
register
(
'loadgist'
,
(
id
)
=>
{
cmdInterpreter
.
event
.
register
(
'loadgist'
,
(
id
,
cb
)
=>
{
loadFromGist
({
gist
:
id
})
if
(
cb
)
cb
()
})
cmdInterpreter
.
event
.
register
(
'loadurl'
,
(
url
)
=>
{
cmdInterpreter
.
event
.
register
(
'loadurl'
,
(
url
,
cb
)
=>
{
importExternal
(
url
,
(
err
,
content
)
=>
{
if
(
err
)
{
toolTip
(
`Unable to load
${
url
}
from swarm:
${
err
}
`
)
if
(
cb
)
cb
(
err
)
}
else
{
try
{
content
=
JSON
.
parse
(
content
)
for
(
var
k
in
content
.
sources
)
{
var
url
=
content
.
sources
[
k
]
.
urls
[
0
]
// @TODO retrieve all other contents ?
async
.
eachOfSeries
(
content
.
sources
,
(
value
,
file
,
callbackSource
)
=>
{
var
url
=
value
.
urls
[
0
]
// @TODO retrieve all other contents ?
importExternal
(
url
,
(
error
,
content
)
=>
{
if
(
error
)
{
toolTip
(
`Cannot retrieve the content of
${
url
}
:
${
error
}
`
)
}
callbackSource
()
})
}
}
catch
(
e
)
{
filesProviders
[
'swarm'
].
addReadOnly
(
url
,
content
)
}
},
(
error
)
=>
{
if
(
cb
)
cb
(
error
)
})
}
catch
(
e
)
{}
if
(
cb
)
cb
()
}
})
})
cmdInterpreter
.
event
.
register
(
'setproviderurl'
,
(
url
)
=>
{
cmdInterpreter
.
event
.
register
(
'setproviderurl'
,
(
url
,
cb
)
=>
{
executionContext
.
setProviderFromEndpoint
(
url
,
'web3'
,
(
error
)
=>
{
if
(
error
)
toolTip
(
error
)
if
(
cb
)
cb
()
})
})
cmdInterpreter
.
event
.
register
(
'batch'
,
(
url
)
=>
{
cmdInterpreter
.
event
.
register
(
'batch'
,
(
url
,
cb
)
=>
{
var
content
=
editor
.
get
(
editor
.
current
())
if
(
!
content
)
{
toolTip
(
'no content to execute'
)
if
(
cb
)
cb
()
return
}
var
split
=
content
.
split
(
'
\
n'
)
async
.
eachSeries
(
split
,
(
value
,
cb
)
=>
{
cmdInterpreter
.
interpret
(
value
)
?
cb
()
:
cb
(
`Cannot run
${
value
}
. stopping`
)
if
(
!
cmdInterpreter
.
interpret
(
value
,
(
error
)
=>
{
error
?
cb
(
`Cannot run
${
value
}
. stopping`
)
:
cb
()
}))
{
cb
(
`Cannot interpret
${
value
}
. stopping`
)
}
},
(
error
)
=>
{
if
(
error
)
toolTip
(
error
)
if
(
cb
)
cb
()
})
})
...
...
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