mirror of
https://github.com/apache/cordova-android.git
synced 2025-01-19 23:42:53 +08:00
94 lines
26 KiB
JSON
94 lines
26 KiB
JSON
|
{
|
|||
|
"name": "q",
|
|||
|
"version": "0.9.7",
|
|||
|
"description": "A library for promises (CommonJS/Promises/A,B,D)",
|
|||
|
"homepage": "https://github.com/kriskowal/q",
|
|||
|
"author": {
|
|||
|
"name": "Kris Kowal",
|
|||
|
"email": "kris@cixar.com",
|
|||
|
"url": "https://github.com/kriskowal"
|
|||
|
},
|
|||
|
"keywords": [
|
|||
|
"q",
|
|||
|
"promise",
|
|||
|
"promises",
|
|||
|
"promises-a",
|
|||
|
"promises-aplus",
|
|||
|
"deferred",
|
|||
|
"future",
|
|||
|
"async",
|
|||
|
"flow control",
|
|||
|
"fluent",
|
|||
|
"browser",
|
|||
|
"node"
|
|||
|
],
|
|||
|
"contributors": [
|
|||
|
{
|
|||
|
"name": "Kris Kowal",
|
|||
|
"email": "kris@cixar.com",
|
|||
|
"url": "https://github.com/kriskowal"
|
|||
|
},
|
|||
|
{
|
|||
|
"name": "Irakli Gozalishvili",
|
|||
|
"email": "rfobic@gmail.com",
|
|||
|
"url": "http://jeditoolkit.com"
|
|||
|
},
|
|||
|
{
|
|||
|
"name": "Domenic Denicola",
|
|||
|
"email": "domenic@domenicdenicola.com",
|
|||
|
"url": "http://domenicdenicola.com"
|
|||
|
}
|
|||
|
],
|
|||
|
"bugs": {
|
|||
|
"url": "http://github.com/kriskowal/q/issues"
|
|||
|
},
|
|||
|
"license": {
|
|||
|
"type": "MIT",
|
|||
|
"url": "http://github.com/kriskowal/q/raw/master/LICENSE"
|
|||
|
},
|
|||
|
"main": "q.js",
|
|||
|
"repository": {
|
|||
|
"type": "git",
|
|||
|
"url": "git://github.com/kriskowal/q.git"
|
|||
|
},
|
|||
|
"engines": {
|
|||
|
"node": ">=0.6.0",
|
|||
|
"teleport": ">=0.2.0"
|
|||
|
},
|
|||
|
"dependencies": {},
|
|||
|
"devDependencies": {
|
|||
|
"jshint": "~2.1.9",
|
|||
|
"cover": "*",
|
|||
|
"jasmine-node": "1.11.0",
|
|||
|
"opener": "*",
|
|||
|
"promises-aplus-tests": "1.x",
|
|||
|
"grunt": "~0.4.1",
|
|||
|
"grunt-cli": "~0.1.9",
|
|||
|
"grunt-contrib-uglify": "~0.2.2",
|
|||
|
"matcha": "~0.2.0"
|
|||
|
},
|
|||
|
"scripts": {
|
|||
|
"test": "jasmine-node spec && promises-aplus-tests spec/aplus-adapter",
|
|||
|
"test-browser": "opener spec/q-spec.html",
|
|||
|
"benchmark": "matcha",
|
|||
|
"lint": "jshint q.js",
|
|||
|
"cover": "cover run node_modules/jasmine-node/bin/jasmine-node spec && cover report html && opener cover_html/index.html",
|
|||
|
"minify": "grunt",
|
|||
|
"prepublish": "grunt"
|
|||
|
},
|
|||
|
"overlay": {
|
|||
|
"teleport": {
|
|||
|
"dependencies": {
|
|||
|
"system": ">=0.0.4"
|
|||
|
}
|
|||
|
}
|
|||
|
},
|
|||
|
"directories": {
|
|||
|
"test": "./spec"
|
|||
|
},
|
|||
|
"readme": "[![Build Status](https://secure.travis-ci.org/kriskowal/q.png?branch=master)](http://travis-ci.org/kriskowal/q)\n\n<a href=\"http://promises-aplus.github.com/promises-spec\">\n <img src=\"http://promises-aplus.github.com/promises-spec/assets/logo-small.png\"\n align=\"right\" alt=\"Promises/A+ logo\" />\n</a>\n\nIf a function cannot return a value or throw an exception without\nblocking, it can return a promise instead. A promise is an object\nthat represents the return value or the thrown exception that the\nfunction may eventually provide. A promise can also be used as a\nproxy for a [remote object][Q-Connection] to overcome latency.\n\n[Q-Connection]: https://github.com/kriskowal/q-connection\n\nOn the first pass, promises can mitigate the “[Pyramid of\nDoom][POD]”: the situation where code marches to the right faster\nthan it marches forward.\n\n[POD]: http://calculist.org/blog/2011/12/14/why-coroutines-wont-work-on-the-web/\n\n```javascript\nstep1(function (value1) {\n step2(value1, function(value2) {\n step3(value2, function(value3) {\n step4(value3, function(value4) {\n // Do something with value4\n });\n });\n });\n});\n```\n\nWith a promise library, you can flatten the pyramid.\n\n```javascript\nQ.fcall(promisedStep1)\n.then(promisedStep2)\n.then(promisedStep3)\n.then(promisedStep4)\n.then(function (value4) {\n // Do something with value4\n})\n.catch(function (error) {\n // Handle any error from all above steps\n})\n.done();\n```\n\nWith this approach, you also get implicit error propagation, just like `try`,\n`catch`, and `finally`. An error in `promisedStep1` will flow all the way to\nthe `catch` function, where it’s caught and handled. (Here `promisedStepN` is\na version of `stepN` that returns a promise.)\n\nThe callback approach is called an “inversion of control”.\nA function that accepts a callback instead of a return value\nis saying, “Don’t call me, I’ll call you.”. Promises\n[un-invert][IOC] the inversion, cleanly separating the input\narguments from control flow arguments. This simplifies the\nuse and creation of API’s, particularly variadic,\nrest and spread arguments.\n\n[IOC]: http://www.slideshare.net/domenicdenicola/callbacks-promises-and-coroutines-oh-my-the-evolution-of-asynchronicity-in-javascript\n\n\n## Getting Started\n\nThe Q module can be loaded as:\n\n- A ``<script>`` tag (creating a ``Q`` global variable): ~2.5 KB minified and\n gzipped.\n- A Node.js and CommonJS module, available in [npm](https://npmjs.org/) as\n the [q](https://npmjs.org/package/q) package\n- An AMD module\n- A [component](https://github.com/component/component) as ``microjs/q``\n- Using [bower](http://bower.io/) as ``q``\n- Using [NuGet](http://nuget.org/) as [Q](https://nuget.org/packages/q)\n\nQ can exchange promises with jQuery, Dojo, When.js, WinJS, and more.\n\n## Resources\n\nOur [wiki][] contains a number of useful resources, including:\n\n- A method-by-method [Q API reference][reference].\n- A growing [examples gallery][examples], showing how Q can be used to make\n everything better. From XHR to database access to accessing the Flickr API,\n Q is there for you.\n- There are many libraries that produce and consume Q promises for everything\n from file system/database access or RPC to templating. For a list of some of\n the more popular ones, see [Libraries][].\n- If you want materials that introduce the promise concept generally, and the\n below tutorial isn't doing it for you, check out our collection of\n [presentations, blog posts, and podcasts][resources].\n- A guide for those [coming from jQuery's `$.Deferred`][jquery].\n\nWe'd also love to have you join the Q-Continuum [mailing list][].\n\n[wiki]: https://github.com/kriskowal/q/wiki\n[reference]: https://github.com/kriskowal/q/wiki/API-Reference\n[examples]: https://github.com/kriskowal/q/wiki/Examples-Gallery\n[Libraries]: https://github.com/kriskowal/q/wiki/Libraries\n[resources]: https://github.com/kriskowal/q/wiki
|
|||
|
"readmeFilename": "README.md",
|
|||
|
"_id": "q@0.9.7",
|
|||
|
"_from": "q@~0.9"
|
|||
|
}
|