Skip to content

Commit

Permalink
ProxyDAO optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
Boris Shevchenko committed Feb 21, 2017
1 parent d3c2040 commit 7e174c9
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/dao/ProxyDAO.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,20 @@ export default class ProxyDAO extends AbstractProxyDAO {
constructor(address) {
super();
ChronoBankAssetProxy.setProvider(this.web3.currentProvider);
this.contract = ChronoBankAssetProxy.at(address);

this.contractDeployed = null;
ChronoBankAssetProxy.at(address).then(deployed => this.contractDeployed = deployed);

this.contract = new Promise(resolve => {
let interval = null;
let callback = () => {
if (this.contractDeployed) {
clearInterval(interval);
resolve(this.contractDeployed);
}
};
callback();
interval = setInterval(callback, 100);
});
}
}

0 comments on commit 7e174c9

Please sign in to comment.