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
6716a082
Commit
6716a082
authored
Jul 05, 2018
by
yann300
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remix extension api helper
parent
5ef159ed
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
220 additions
and
0 deletions
+220
-0
bundle.js
src/app/plugin/wrapper/bundle.js
+94
-0
index.js
src/app/plugin/wrapper/index.js
+55
-0
package.json
src/app/plugin/wrapper/package.json
+71
-0
No files found.
src/app/plugin/wrapper/bundle.js
0 → 100644
View file @
6716a082
(
function
e
(
t
,
n
,
r
){
function
s
(
o
,
u
){
if
(
!
n
[
o
]){
if
(
!
t
[
o
]){
var
a
=
typeof
require
==
"function"
&&
require
;
if
(
!
u
&&
a
)
return
a
(
o
,
!
0
);
if
(
i
)
return
i
(
o
,
!
0
);
var
f
=
new
Error
(
"Cannot find module '"
+
o
+
"'"
);
throw
f
.
code
=
"MODULE_NOT_FOUND"
,
f
}
var
l
=
n
[
o
]
=
{
exports
:{}};
t
[
o
][
0
].
call
(
l
.
exports
,
function
(
e
){
var
n
=
t
[
o
][
1
][
e
];
return
s
(
n
?
n
:
e
)},
l
,
l
.
exports
,
e
,
t
,
n
,
r
)}
return
n
[
o
].
exports
}
var
i
=
typeof
require
==
"function"
&&
require
;
for
(
var
o
=
0
;
o
<
r
.
length
;
o
++
)
s
(
r
[
o
]);
return
s
})({
1
:[
function
(
require
,
module
,
exports
){
'use strict'
;
var
_createClass
=
function
()
{
function
defineProperties
(
target
,
props
)
{
for
(
var
i
=
0
;
i
<
props
.
length
;
i
++
)
{
var
descriptor
=
props
[
i
];
descriptor
.
enumerable
=
descriptor
.
enumerable
||
false
;
descriptor
.
configurable
=
true
;
if
(
"value"
in
descriptor
)
descriptor
.
writable
=
true
;
Object
.
defineProperty
(
target
,
descriptor
.
key
,
descriptor
);
}
}
return
function
(
Constructor
,
protoProps
,
staticProps
)
{
if
(
protoProps
)
defineProperties
(
Constructor
.
prototype
,
protoProps
);
if
(
staticProps
)
defineProperties
(
Constructor
,
staticProps
);
return
Constructor
;
};
}();
function
_classCallCheck
(
instance
,
Constructor
)
{
if
(
!
(
instance
instanceof
Constructor
))
{
throw
new
TypeError
(
"Cannot call a class as a function"
);
}
}
var
RemixExtension
=
function
()
{
function
RemixExtension
()
{
var
_this
=
this
;
_classCallCheck
(
this
,
RemixExtension
);
this
.
_notifications
=
{};
this
.
_pendingRequests
=
{};
this
.
_id
=
0
;
window
.
addEventListener
(
'message'
,
function
(
event
)
{
return
_this
.
_newMessage
(
event
);
},
false
);
}
_createClass
(
RemixExtension
,
[{
key
:
'listen'
,
value
:
function
listen
(
key
,
type
,
callback
)
{
if
(
!
this
.
_notifications
[
key
])
this
.
_notifications
[
key
]
=
{};
this
.
_notifications
[
key
][
type
]
=
callback
;
}
},
{
key
:
'call'
,
value
:
function
call
(
key
,
type
,
params
,
callback
)
{
this
.
_id
++
;
this
.
_pendingRequests
[
this
.
_id
]
=
callback
;
window
.
parent
.
postMessage
(
JSON
.
stringify
({
action
:
'request'
,
key
:
key
,
type
:
type
,
value
:
params
,
id
:
this
.
_id
}),
'*'
);
}
},
{
key
:
'_newMessage'
,
value
:
function
_newMessage
(
event
)
{
if
(
!
event
.
data
)
return
;
if
(
typeof
event
.
data
!==
'string'
)
return
;
var
msg
;
try
{
msg
=
JSON
.
parse
(
event
.
data
);
}
catch
(
e
)
{
return
console
.
log
(
'unable to parse data'
);
}
var
_msg
=
msg
,
action
=
_msg
.
action
,
key
=
_msg
.
key
,
type
=
_msg
.
type
,
value
=
_msg
.
value
;
if
(
action
===
'notification'
)
{
if
(
this
.
_notifications
[
key
]
&&
this
.
_notifications
[
key
][
type
])
{
this
.
_notifications
[
key
][
type
](
value
);
}
}
else
if
(
action
===
'response'
)
{
var
_msg2
=
msg
,
id
=
_msg2
.
id
,
error
=
_msg2
.
error
;
if
(
this
.
_pendingRequests
[
id
])
{
this
.
_pendingRequests
[
id
](
error
,
value
);
delete
this
.
_pendingRequests
[
id
];
}
}
}
}]);
return
RemixExtension
;
}();
if
(
window
)
window
.
RemixExtension
=
RemixExtension
;
if
(
module
&&
module
.
exports
)
module
.
exports
=
RemixExtension
;
},{}]},{},[
1
]);
src/app/plugin/wrapper/index.js
0 → 100644
View file @
6716a082
'use strict'
class
RemixExtension
{
constructor
()
{
this
.
_notifications
=
{}
this
.
_pendingRequests
=
{}
this
.
_id
=
0
window
.
addEventListener
(
'message'
,
(
event
)
=>
this
.
_newMessage
(
event
),
false
)
}
listen
(
key
,
type
,
callback
)
{
if
(
!
this
.
_notifications
[
key
])
this
.
_notifications
[
key
]
=
{}
this
.
_notifications
[
key
][
type
]
=
callback
}
call
(
key
,
type
,
params
,
callback
)
{
this
.
_id
++
this
.
_pendingRequests
[
this
.
_id
]
=
callback
window
.
parent
.
postMessage
(
JSON
.
stringify
({
action
:
'request'
,
key
,
type
,
value
:
params
,
id
:
this
.
_id
}),
'*'
)
}
_newMessage
(
event
)
{
if
(
!
event
.
data
)
return
if
(
typeof
event
.
data
!==
'string'
)
return
var
msg
try
{
msg
=
JSON
.
parse
(
event
.
data
)
}
catch
(
e
)
{
return
console
.
log
(
'unable to parse data'
)
}
const
{
action
,
key
,
type
,
value
}
=
msg
if
(
action
===
'notification'
)
{
if
(
this
.
_notifications
[
key
]
&&
this
.
_notifications
[
key
][
type
])
{
this
.
_notifications
[
key
][
type
](
value
)
}
}
else
if
(
action
===
'response'
)
{
const
{
id
,
error
}
=
msg
if
(
this
.
_pendingRequests
[
id
])
{
this
.
_pendingRequests
[
id
](
error
,
value
)
delete
this
.
_pendingRequests
[
id
]
}
}
}
}
if
(
window
)
window
.
RemixExtension
=
RemixExtension
if
(
module
&&
module
.
exports
)
module
.
exports
=
RemixExtension
src/app/plugin/wrapper/package.json
0 → 100644
View file @
6716a082
{
"name"
:
"remix-extension"
,
"version"
:
"0.0.1"
,
"description"
:
"Ethereum IDE and tools for the web"
,
"contributors"
:
[
{
"name"
:
"Yann Levreau"
,
"email"
:
"yann@ethdev.com"
}
],
"main"
:
"./index.js"
,
"dependencies"
:
{
"babel-eslint"
:
"^7.1.1"
,
"babel-plugin-transform-object-assign"
:
"^6.22.0"
,
"babel-preset-es2015"
:
"^6.24.0"
,
"babelify"
:
"^7.3.0"
,
"standard"
:
"^7.0.1"
,
"tape"
:
"^4.6.0"
},
"scripts"
:
{
"browserify"
:
"browserify index.js -o bundle.js"
},
"standard"
:
{
"ignore"
:
[
"node_modules/*"
],
"parser"
:
"babel-eslint"
},
"repository"
:
{
"type"
:
"git"
,
"url"
:
"git+https://github.com/ethereum/remix-ide.git"
},
"author"
:
"cpp-ethereum team"
,
"license"
:
"MIT"
,
"bugs"
:
{
"url"
:
"https://github.com/ethereum/remix-ide/issues"
},
"homepage"
:
"https://github.com/ethereum/remix-ide#readme"
,
"browserify"
:
{
"transform"
:
[
[
"babelify"
,
{
"plugins"
:
[
[
"fast-async"
,
{
"runtimePatten"
:
null
,
"compiler"
:
{
"promises"
:
true
,
"es7"
:
true
,
"noRuntime"
:
true
,
"wrapAwait"
:
true
}
}
],
"transform-object-assign"
]
}
],
[
"babelify"
,
{
"presets"
:
[
"es2015"
]
}
]
]
}
}
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