mirror of https://github.com/embarklabs/embark.git
Fix register var and runcode
This commit is contained in:
parent
cc312a91b6
commit
98c785a4bb
|
@ -56,23 +56,24 @@ class CodeRunner {
|
|||
}
|
||||
|
||||
registerEmbarkJs() {
|
||||
this.registerVar('IpfsApi', IpfsApi, false);
|
||||
this.registerVar('Web3', Web3, false);
|
||||
this.registerVar('EmbarkJS', EmbarkJS, false);
|
||||
|
||||
if (this.ipc.connected) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.registerVar('IpfsApi', IpfsApi);
|
||||
this.registerVar('Web3', Web3);
|
||||
this.registerVar('EmbarkJS', EmbarkJS);
|
||||
this.events.on('code-generator-ready', () => {
|
||||
this.events.request('code-generator:embarkjs:provider-code', (code) => {
|
||||
this.evalCode(code);
|
||||
this.evalCode(this.getInitProviderCode());
|
||||
const func = () => {};
|
||||
this.evalCode(code, func, true);
|
||||
this.evalCode(this.getInitProviderCode(), func, true);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
registerVar(varName, code) {
|
||||
if (this.ipc.isServer() && varName !== 'web3') {
|
||||
registerVar(varName, code, toRecord = true) {
|
||||
if (this.ipc.isServer() && toRecord) {
|
||||
this.commands.push({varName, code});
|
||||
this.ipc.broadcast("runcode:newCommand", {varName, code});
|
||||
}
|
||||
|
|
|
@ -254,7 +254,7 @@ class BlockchainConnector {
|
|||
registerWeb3Object() {
|
||||
// doesn't feel quite right, should be a cmd or plugin method
|
||||
// can just be a command without a callback
|
||||
this.events.emit("runcode:register", "web3", this.web3);
|
||||
this.events.emit("runcode:register", "web3", this.web3, false);
|
||||
}
|
||||
|
||||
subscribeToPendingTransactions() {
|
||||
|
|
Loading…
Reference in New Issue