embark/dapps/templates/demo
Pascal Precht 93ca3ad97c fix(@embark/embarkjs-whisper): Messages.isAvailable() should always return a promise
`EmbarkJS.Messages.isAvailable()` in some cases return synchronously (when whisper isn't
set up), in other cases asynchronously. This actually breaks our demo application for
the following reason:

We check for Whisper's availability via:

```
EmbarkJS.Messages.Providers.whisper.getWhisperVersion((err, _version) => {
  if (err) {
    return console.log(err);
  }
  this.setState({whisperEnabled: true});
});
```

There's a couple of problems here:

- This code will break right away when whisper isn't available, resulting in an error:
  ```
  Cannot read property _requestManager of undefined
  ```

- The reason this error happens is because there's no `web3` object available inside
  our EmbarkJS.Messages code. Even though there **is** a web3 object, EmbarkJS.Messages
  doesn't know about this because it only sets it when its `setProvider()` API is called,
  which effectively doesn't happen at all when Whisper isn't enabled on the connected
  node

- While this could be fixed with a simple check on whether EmbarkJS.Messages' internal
  `web3` references is a thing, really what should be used in the demo is the `isAvailable()`
  API.

`isAvailable()` should always return a promise (similar to `EmbarkJS.Storage.isAvailable()`.

This commit ensures that `isAvailable()` always returns a promise and changes the demo
template to use `isAvailable()` over `getWhisperVersion()`.
2019-07-01 11:11:03 +02:00
..
app fix(@embark/embarkjs-whisper): Messages.isAvailable() should always return a promise 2019-07-01 11:11:03 +02:00
config feat(@embark/pipeline): Add `enabled` property to pipeline config 2019-03-12 07:53:04 -04:00
contracts refactor(embark-ui): improve cockpit's contracts explorer 2019-03-15 12:03:52 -05:00
test build: make DApp templates member packages of the monorepo 2019-03-05 10:20:57 -06:00
.npmrc build: make DApp templates member packages of the monorepo 2019-03-05 10:20:57 -06:00
CHANGELOG.md chore(release): 4.1.0-beta.4 2019-06-27 14:23:32 -05:00
README.md feat: normalize README and package.json bugs, homepage, description 2019-03-12 09:17:33 -04:00
dot.gitignore build: make DApp templates member packages of the monorepo 2019-03-05 10:20:57 -06:00
dot.npmrc build: make DApp templates member packages of the monorepo 2019-03-05 10:20:57 -06:00
embark.json refactor(@embarkjs/web3): make web3 connector an internal plugin like the other embarkjs-* packages 2019-06-27 14:10:12 -05:00
package.json chore(release): 4.1.0-beta.4 2019-06-27 14:23:32 -05:00

README.md

embark-dapp-template-demo

Demo DApp for Embark

Visit embark.status.im to get started with Embark.