{"name":"vow","version":"0.4.11","description":"DOM Promise and Promises/A+ implementation for Node.js and browsers","homepage":"http://dfilatov.github.io/vow/","keywords":["nodejs","browser","async","promise","dom","a+"],"author":{"name":"Dmitry Filatov","email":"dfilatov@yandex-team.ru"},"contributors":[{"name":"Dmitry Filatov","email":"dfilatov@yandex-team.ru"}],"repository":{"type":"git","url":"http://github.com/dfilatov/vow.git"},"dependencies":{},"devDependencies":{"nodeunit":"","istanbul":"","uglify-js":"1.3.4","promises-aplus-tests":"2.1.0","marked":"0.2.10","jspath":"0.2.11","yate":"0.0.65","highlight.js":"7.5.0","bem-jsd":"1.3.1"},"main":"lib/vow","engines":{"node":">= 0.4.0"},"scripts":{"test":"./node_modules/istanbul/lib/cli.js test test/utils/runner.js"},"enb":{"sources":["lib/vow.js"]},"readme":"<a href=\"http://promises-aplus.github.com/promises-spec\"><img src=\"http://promises-aplus.github.com/promises-spec/assets/logo-small.png\" align=\"right\" /></a>\r\nVow 0.4.10 [![NPM version](https://badge.fury.io/js/vow.png)](http://badge.fury.io/js/vow) [![Build Status](https://secure.travis-ci.org/dfilatov/vow.png)](http://travis-ci.org/dfilatov/vow)\r\n=========\r\n\r\nVow is a [Promises/A+](http://promisesaplus.com/) implementation.\r\nIt also supports [ES6 Promises](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-promise-objects) specification.\r\n\r\nFull API reference can be found at http://dfilatov.github.io/vow/.\r\n\r\nGetting Started\r\n---------------\r\n### In Node.js ###\r\nYou can install using Node Package Manager (npm):\r\n\r\n    npm install vow\r\n\r\n### In Browsers ###\r\n```html\r\n<script type=\"text/javascript\" src=\"vow.min.js\"></script>\r\n```\r\nIt also supports RequireJS module format and [YM module](https://github.com/ymaps/modules) format.\r\n\r\nVow has been tested in IE6+, Mozilla Firefox 3+, Chrome 5+, Safari 5+, Opera 10+.\r\n\r\nUsage\r\n-----\r\n### Creating a promise ###\r\nThere are two possible ways to create a promise.\r\n#### 1. Using a deferred ####\r\n```js\r\nfunction doSomethingAsync() {\r\n    var deferred = vow.defer();\r\n    \r\n    // now you can resolve, reject, notify corresponging promise within `deferred`\r\n    // e.g. `defer.resolve('ok');`\r\n        \r\n    return deferred.promise(); // and return corresponding promise to subscribe to reactions\r\n}\r\n\r\ndoSomethingAsync().then(\r\n    function() {}, // onFulfilled reaction\r\n    function() {}, // onRejected reaction\r\n    function() {}  // onNotified reaction\r\n    );\r\n```\r\nThe difference between `deferred` and `promise` is that `deferred` contains methods to resolve, reject and notify corresponding promise, but the `promise` by itself allows only to subscribe on these actions.\r\n\r\n#### 2. ES6-compatible way ####\r\n```js\r\nfunction doSomethingAsync() {\r\n    return new vow.Promise(function(resolve, reject, notify) {\r\n        // now you can resolve, reject, notify the promise\r\n    });\r\n}\r\n\r\ndoSomethingAsync().then(\r\n    function() {}, // onFulfilled reaction\r\n    function() {}, // onRejected reaction\r\n    function() {}  // onNotified reaction\r\n    );\r\n```\r\n\r\nExtensions and related projects\r\n-------------------------------\r\n  * [vow-fs](https://github.com/dfilatov/vow-fs) — vow-based file I/O for Node.js\r\n  * [vow-node](https://github.com/dfilatov/vow-node) — extension for vow to work with nodejs-style callbacks\r\n  * [vow-queue](https://github.com/dfilatov/vow-queue) — vow-based task queue with weights and priorities\r\n  * [vow-asker](https://github.com/nodules/vow-asker) — wraps [asker](https://github.com/nodules/asker) API in the vow promises implementation\r\n\r\n**NOTE**. Documentation for old versions of the library can be found at https://github.com/dfilatov/vow/blob/0.3.x/README.md.\r\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/dfilatov/vow/issues"},"_id":"vow@0.4.11","_shasum":"b7bf18852a2cad7892a2c5c538c4cd7bb3ee13c8","_from":"https://registry.npmjs.org/vow/-/vow-0.4.11.tgz","_resolved":"https://registry.npmjs.org/vow/-/vow-0.4.11.tgz"}