Framework for serverless Decentralized Applications using Ethereum, IPFS and other platforms https://framework.embarklabs.io/
Go to file
Michael Bradley, Jr 23ae78a6d6 refactor: be consistent with callbacks and promises
If a function receives a callback argument then it should not return a promise
if the caller's callback will be invoked. Both invoking a callback and
returning a promise can lead to at best confusion (in code review and at
runtime) and at worst non-deterministic behavior, such as race
conditions. Also, a caller supplying a callback may not handle a returned
promise, leading to unhandled rejection errors.

Refactor all readily identified functions where a callback argument can be
supplied but the function returns a promise regardless. Make use of
`callbackify` and `promisify` where it made sense to do so during the
refactoring. Some callsites of the revised functions may have been accidentally
overlooked and still need to be updated. Some functions that take callback
arguments may execute them synchronously, at odds with control flow of a
returned promise (if a callback wasn't supplied). Such cases should be
identified and fixed so that asynchronous behavior is fully consistent whether
the caller supplies a callback or receives a promise.

Make sure promises that pass control flow to a callback ignore rejections,
since those should be handled by the callback.

Don't return promise instances unnecessarily from async functions (since they
always return promises) and change some functions that return promises to async
functions (where it's simple to do so).

Whisper was using an ad hoc promise-like `messageEvents` object. However, that
object behaved more like an observable, since promises either resolve or
reject, and only do so one time. `messageEvents` was also intertwined with
callbacks. Replace `messageEvents` with RxJS Observable. `listenTo` now returns
Observable instances and callers can subscribe to them.

`Blockchain.connect` of embarkjs could suffer from a race condition where tasks
associated with `execWhenReady` might be ongoing when `connect`'s returned
promise resolves/rejects (or a caller supplied callback fires). Attempt to
ensure that returned-promise / supplied-callback control flow proceeds only
after `execWhenReady` tasks have finished. The control flow involved
is... rather involved, and it could use some further review and refactoring.

Bump webpack and the hard-source-plugin for webpack.

[util]: https://www.npmjs.com/package/util
2019-02-13 14:27:42 -05:00
.github chore: introduce issue and pull request templates 2018-11-07 17:31:17 +01:00
packages refactor: be consistent with callbacks and promises 2019-02-13 14:27:42 -05:00
scripts build: implement a monorepo with Lerna 2019-02-04 14:28:49 -06:00
test_dapps refactor: be consistent with callbacks and promises 2019-02-13 14:27:42 -05:00
.editorconfig Add editor config 2018-10-22 19:25:16 +02:00
.eslintrc.json build: cleanup eslint configuration 2019-02-06 11:26:41 -06:00
.gitignore build: cleanup .gitignore 2019-02-05 18:08:14 -06:00
.npmrc build: introduce a `prepare` script in embark's package.json 2018-12-03 16:24:10 -06:00
.travis.yml build: implement a monorepo with Lerna 2019-02-04 14:28:49 -06:00
.yarnrc build: implement a monorepo with Lerna 2019-02-04 14:28:49 -06:00
CODE_OF_CONDUCT.md chore(@embark) remove extra line 2018-12-24 16:14:01 -05:00
CONTRIBUTING.md build: implement a monorepo with Lerna 2019-02-04 14:28:49 -06:00
LICENSE add license 2015-07-10 20:41:45 -04:00
README.md feature(embark): add coveralls integration 2019-02-08 17:07:05 -05:00
appveyor.yml build: implement a monorepo with Lerna 2019-02-04 14:28:49 -06:00
babel.config.js build: implement a common babel config 2019-02-06 11:34:47 -05:00
header.png Update header 2018-09-27 10:23:03 -04:00
lerna.json build: implement a monorepo with Lerna 2019-02-04 14:28:49 -06:00
package.json fix hoisting problem 2019-02-12 16:59:54 -05:00
tsconfig.json fix: supply missing tsconfig.json in packages/* 2019-02-06 17:20:13 -06:00
tslint.json refactor(@embark/embark-typings) move typings to its own module 2019-02-06 11:07:44 -05:00
yarn.lock refactor: be consistent with callbacks and promises 2019-02-13 14:27:42 -05:00

README.md

Embark

npm Gitter Build Status Build status Open PRs Closed PRs GitHub commit activity the past week, 4 weeks, year Coverage Status

What is Embark

Embark is a framework that allows you to easily develop and deploy Decentralized Applications (DApps).

A Decentralized Application is a serverless html5 application that uses one or more decentralized technologies.

Embark currently integrates with EVM blockchains (Ethereum), Decentralized Storages (IPFS), and Decentralized communication platforms (Whisper and Orbit). Swarm is supported for deployment.

With Embark you can:

Blockchain (Ethereum)

  • Automatically deploy contracts and make them available in your JS code. Embark watches for changes, and if you update a contract, Embark will automatically redeploy the contracts (if needed) and the dapp.
  • Contracts are available in JS with Promises.
  • Do Test Driven Development with Contracts using Javascript.
  • Keep track of deployed contracts; deploy only when truly needed.
  • Manage different chains (e.g testnet, private net, livenet)
  • Easily manage complex systems of interdependent contracts.

Decentralized Storage (IPFS, Swarm)

  • Easily Store & Retrieve Data on the DApp through EmbarkJS. Including uploading and retrieving files.
  • Deploy the full application to IPFS or Swarm.
  • Import and deploy contracts hosted on Swarm.

Decentralized Communication (Whisper, Orbit)

  • Easily send/receive messages through channels in P2P through Whisper or Orbit.

Web Technologies

  • Integrate with any web technology including React, Foundation, etc..
  • Use any build pipeline or tool you wish, including grunt, gulp and webpack.
$ npm -g install embark

See Complete Documentation.