From dbb640642bdad515eaa8ee1fb41ae4b74f7753e1 Mon Sep 17 00:00:00 2001 From: Richard Ramos Date: Fri, 27 Apr 2018 11:47:35 -0400 Subject: [PATCH] Removed timeout --- templates/demo/app/dapp.js | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/templates/demo/app/dapp.js b/templates/demo/app/dapp.js index ddd6b0fa..5c5f121a 100644 --- a/templates/demo/app/dapp.js +++ b/templates/demo/app/dapp.js @@ -21,30 +21,28 @@ class App extends React.Component { } componentDidMount(){ - let _this = this; - - setTimeout(() => { + __embarkContext.execWhenReady(() => { if (EmbarkJS.isNewWeb3()) { - EmbarkJS.Messages.Providers.whisper.getWhisperVersion(function(err, version){ + EmbarkJS.Messages.Providers.whisper.getWhisperVersion((err, version) => { if(!err) - _this.setState({whisperEnabled: true}) + this.setState({whisperEnabled: true}) else console.log(err); }); } else { if (EmbarkJS.Messages.providerName === 'whisper') { - EmbarkJS.Messages.getWhisperVersion(function(err, version) { + EmbarkJS.Messages.getWhisperVersion((err, version) => { if(!err) - _this.setState({whisperEnabled: true}) + this.setState({whisperEnabled: true}) else console.log(err); }); } } - }, 500); - this.setState({ - storageEnabled: true + this.setState({ + storageEnabled: true + }); }); }