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
a93da3de
Commit
a93da3de
authored
Feb 28, 2018
by
yann300
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix setproviderurl,swarm command & add batch command
parent
75bd6a3d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
17 deletions
+29
-17
app.js
src/app.js
+29
-17
No files found.
src/app.js
View file @
a93da3de
...
...
@@ -6,7 +6,6 @@ var yo = require('yo-yo')
var
async
=
require
(
'async'
)
var
remixLib
=
require
(
'remix-lib'
)
var
EventManager
=
remixLib
.
EventManager
var
swarmgw
=
require
(
'swarmgw'
)
var
UniversalDApp
=
require
(
'./universal-dapp.js'
)
var
UniversalDAppUI
=
require
(
'./universal-dapp-ui.js'
)
...
...
@@ -365,30 +364,43 @@ Please make a backup of your contracts and start using http://remix.ethereum.org
cmdInterpreter
.
event
.
register
(
'loadgist'
,
(
id
)
=>
{
loadFromGist
({
gist
:
id
})
})
cmdInterpreter
.
event
.
register
(
'load
swarm
'
,
(
url
)
=>
{
swarmgw
.
get
(
url
,
function
(
err
,
content
)
{
cmdInterpreter
.
event
.
register
(
'load
url
'
,
(
url
)
=>
{
importExternal
(
url
,
(
err
,
content
)
=>
{
if
(
err
)
{
modalDialogCustom
.
log
(
`Unable to load
${
url
}
from swarm:
${
err
}
`
)
toolTip
(
`Unable to load
${
url
}
from swarm:
${
err
}
`
)
}
else
{
content
=
JSON
.
parse
(
content
)
for
(
var
k
in
content
.
sources
)
{
var
url
=
content
.
sources
[
k
].
urls
[
0
]
// @TODO retrieve all other contents ?
swarmgw
.
get
(
url
,
(
error
,
content
)
=>
{
if
(
!
error
)
{
filesProviders
[
'browser'
].
addReadOnly
(
k
,
content
)
}
else
{
filesProviders
[
'browser'
].
addReadOnly
(
k
,
`Cannot retrieve the content of
${
url
}
:
${
error
}
`
)
if
(
content
.
settings
&&
Object
.
keys
(
content
.
settings
.
compilationTarget
)[
0
]
===
k
)
{
fileManager
.
switchFile
(
Object
.
keys
(
content
.
settings
.
compilationTarget
)[
0
])
try
{
content
=
JSON
.
parse
(
content
)
for
(
var
k
in
content
.
sources
)
{
var
url
=
content
.
sources
[
k
].
urls
[
0
]
// @TODO retrieve all other contents ?
importExternal
(
url
,
(
error
,
content
)
=>
{
if
(
error
)
{
toolTip
(
`Cannot retrieve the content of
${
url
}
:
${
error
}
`
)
}
}
})
})
}
}
catch
(
e
)
{
filesProviders
[
'swarm'
].
addReadOnly
(
url
,
content
)
}
}
})
})
cmdInterpreter
.
event
.
register
(
'setproviderurl'
,
(
url
)
=>
{
executionContext
.
setContext
(
'web3'
,
url
,
true
)
executionContext
.
setProviderFromEndpoint
(
url
,
'web3'
,
(
error
)
=>
{
if
(
error
)
toolTip
(
error
)
})
})
cmdInterpreter
.
event
.
register
(
'batch'
,
(
url
)
=>
{
var
content
=
editor
.
get
(
editor
.
current
())
if
(
!
content
)
{
toolTip
(
'no content to execute'
)
}
var
split
=
content
.
split
(
'
\
n'
)
async
.
eachSeries
(
split
,
(
value
,
cb
)
=>
{
cmdInterpreter
.
interpret
(
value
)
?
cb
()
:
cb
(
`Cannot run
${
value
}
. stopping`
)
},
(
error
)
=>
{
if
(
error
)
toolTip
(
error
)
})
})
// ----------------- editor ----------------------------
...
...
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