mirror of
https://github.com/embarklabs/EmbarkJS.git
synced 2025-02-19 23:58:16 +00:00
feature: pass network info to onReady
This commit is contained in:
parent
aacb23f3e9
commit
8aff0a8b04
@ -90,7 +90,7 @@ Blockchain.connect = function(connectionList, opts, doneCb) {
|
|||||||
|
|
||||||
Blockchain.execWhenReady = function(cb) {
|
Blockchain.execWhenReady = function(cb) {
|
||||||
if (this.done) {
|
if (this.done) {
|
||||||
return cb(this.err);
|
return cb(this.err, this.web3);
|
||||||
}
|
}
|
||||||
if (!this.list) {
|
if (!this.list) {
|
||||||
this.list = [];
|
this.list = [];
|
||||||
@ -104,7 +104,7 @@ Blockchain.doFirst = function(todo) {
|
|||||||
self.done = true;
|
self.done = true;
|
||||||
self.err = err;
|
self.err = err;
|
||||||
if (self.list) {
|
if (self.list) {
|
||||||
self.list.map((x) => x.apply(x, [self.err]));
|
self.list.map((x) => x.apply(x, [self.err, self.web3]));
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
};
|
};
|
||||||
@ -133,7 +133,7 @@ let Contract = function (options) {
|
|||||||
|
|
||||||
let originalMethods = Object.keys(ContractClass);
|
let originalMethods = Object.keys(ContractClass);
|
||||||
|
|
||||||
Blockchain.execWhenReady(function() {
|
Blockchain.execWhenReady(function(err, web3) {
|
||||||
if(!ContractClass.currentProvider){
|
if(!ContractClass.currentProvider){
|
||||||
ContractClass.setProvider(web3.currentProvider);
|
ContractClass.setProvider(web3.currentProvider);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user