CryptoRyder
所属分类:加密解密
开发工具:JavaScript
文件大小:34727KB
下载次数:0
上传日期:2018-03-01 21:01:08
上 传 者:
sh-1993
说明: 基于以太坊区块链构建的去中心化城际拼车平台。
(A decentralized inter-city ridesharing platform built on the Ethereum blockchain.)
文件列表:
box-img-lg.png (168669, 2018-02-05)
box-img-sm.png (7492, 2018-02-05)
config (0, 2018-02-05)
config\env.js (1102, 2018-02-05)
config\jest (0, 2018-02-05)
config\jest\cssTransform.js (323, 2018-02-05)
config\jest\fileTransform.js (301, 2018-02-05)
config\paths.js (1888, 2018-02-05)
config\polyfills.js (613, 2018-02-05)
config\webpack.config.dev.js (9642, 2018-02-05)
config\webpack.config.prod.js (10068, 2018-02-05)
contracts (0, 2018-02-05)
contracts\Authentication.sol (1294, 2018-02-05)
contracts\Migrations.sol (514, 2018-02-05)
contracts\Rideshare.sol (4715, 2018-02-05)
contracts\zeppelin (0, 2018-02-05)
contracts\zeppelin\lifecycle (0, 2018-02-05)
contracts\zeppelin\lifecycle\Killable.sol (271, 2018-02-05)
contracts\zeppelin\ownership (0, 2018-02-05)
contracts\zeppelin\ownership\Ownable.sol (476, 2018-02-05)
demo1.PNG (1325429, 2018-02-05)
demo2.PNG (51986, 2018-02-05)
migrations (0, 2018-02-05)
migrations\1_initial_migration.js (129, 2018-02-05)
migrations\2_deploy_contracts.js (539, 2018-02-05)
node_modules (0, 2018-02-05)
node_modules\.bin (0, 2018-02-05)
node_modules\.bin\acorn (18, 2018-02-05)
node_modules\.bin\babylon (25, 2018-02-05)
node_modules\.bin\browserslist (22, 2018-02-05)
node_modules\.bin\cdl (22, 2018-02-05)
node_modules\.bin\cssesc (20, 2018-02-05)
node_modules\.bin\csso (16, 2018-02-05)
node_modules\.bin\detect (30, 2018-02-05)
node_modules\.bin\detect-port (30, 2018-02-05)
node_modules\.bin\errno (15, 2018-02-05)
node_modules\.bin\escodegen (29, 2018-02-05)
... ...
[![Build Status](https://secure.travis-ci.org/kriskowal/q.svg?branch=master)](http://travis-ci.org/kriskowal/q)
[![CDNJS](https://img.shields.io/cdnjs/v/q.js.svg)](https://cdnjs.com/libraries/q.js)
If a function cannot return a value or throw an exception without
blocking, it can return a promise instead. A promise is an object
that represents the return value or the thrown exception that the
function may eventually provide. A promise can also be used as a
proxy for a [remote object][Q-Connection] to overcome latency.
[Q-Connection]: https://github.com/kriskowal/q-connection
On the first pass, promises can mitigate the “[Pyramid of
Doom][POD]”: the situation where code marches to the right faster
than it marches forward.
[POD]: http://calculist.org/blog/2011/12/14/why-coroutines-wont-work-on-the-web/
```javascript
step1(function (value1) {
step2(value1, function(value2) {
step3(value2, function(value3) {
step4(value3, function(value4) {
// Do something with value4
});
});
});
});
```
With a promise library, you can flatten the pyramid.
```javascript
Q.fcall(promisedStep1)
.then(promisedStep2)
.then(promisedStep3)
.then(promisedStep4)
.then(function (value4) {
// Do something with value4
})
.catch(function (error) {
// Handle any error from all above steps
})
.done();
```
With this approach, you also get implicit error propagation, just like `try`,
`catch`, and `finally`. An error in `promisedStep1` will flow all the way to
the `catch` function, where it’s caught and handled. (Here `promisedStepN` is
a version of `stepN` that returns a promise.)
The callback approach is called an “inversion of control”.
A function that accepts a callback instead of a return value
is saying, “Don’t call me, I’ll call you.”. Promises
[un-invert][IOC] the inversion, cleanly separating the input
arguments from control flow arguments. This simplifies the
use and creation of API’s, particularly variadic,
rest and spread arguments.
[IOC]: http://www.slideshare.net/domenicdenicola/callbacks-promises-and-coroutines-oh-my-the-evolution-of-asynchronicity-in-javascript
## Getting Started
The Q module can be loaded as:
- A ``