{"_id":"promise-defer","_rev":"5-8f55bb290a8a73e749d1f1dc8ba25329","name":"promise-defer","description":"Polyfill for Promise.defer. Uses the native ES6 Promise. Supports other Promises/A+ implementations.","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"promise-defer","version":"1.0.0","description":"Polyfill for Promise.defer. Uses the native ES6 Promise. Supports other Promises/A+ implementations.","keywords":["defer","deferred","promise","promises","unwrap"],"homepage":"https://github.com/moll/js-promise-defer","bugs":{"url":"https://github.com/moll/js-promise-defer/issues"},"author":{"name":"Andri Möll","email":"andri@dot.ee","url":"http://themoll.com"},"repository":{"type":"git","url":"git://github.com/moll/js-promise-defer.git"},"licenses":[{"type":"LAGPL","url":"https://github.com/moll/js-promise-defer/blob/master/LICENSE"}],"main":"index.js","scripts":{},"devDependencies":{"mocha":">= 1.18.2 < 2","must":">= 0.12.0 < 0.13","bluebird":">= 2.7.1 < 3"},"gitHead":"dfc1e5780f1f8a609ece25d61e4db80faca0a5f7","_id":"promise-defer@1.0.0","_shasum":"25a8093f19bab40c62a8e464c97d04fe4cdc0a24","_from":".","_npmVersion":"2.0.2","_nodeVersion":"0.11.14","_npmUser":{"name":"moll","email":"andri@dot.ee"},"maintainers":[{"name":"moll","email":"andri@dot.ee"}],"dist":{"shasum":"25a8093f19bab40c62a8e464c97d04fe4cdc0a24","tarball":"https://registry.npmjs.org/promise-defer/-/promise-defer-1.0.0.tgz","integrity":"sha512-nMqgchmgxu9tsUwDiFnXszDd+0CaEW2u3iibL5sF2y1+QixdFv8OM0/ZTGj3lUhLl6Ja3XxthRX57fstq/3XjA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDa18lcz0RU/Iqgt+Kc/RommKx8y4uQa88J2x9GI1mnngIgBHyolKsd4BBByIaCrTXMXPWGZunDEQxZXOJLZfyjiBg="}]}}},"readme":"PromiseDefer.js\n===============\n[![NPM version][npm-badge]](http://badge.fury.io/js/promise-defer)\n[npm-badge]: https://badge.fury.io/js/promise-defer.png\n\n**PromiseDefer.js** is a small `Promise.defer` \"polyfill\" to create\na [`Deferred`][deferred] object you can **later resolve or reject** and get\na `Promise` out of. It used to exist in browsers and JavaScript engines as\n`Promise.defer`, but was later deprecated. It's still useful in some cases.\n\nPromiseDefer.js uses the **native ES6 `Promise` by default**, but you can pass\nit another **Promises/A+ compatible** constructor function.\n\n[deferred]: https://developer.mozilla.org/en-US/docs/Mozilla/JavaScript_code_modules/Promise.jsm/Deferred\n[promisesa+]: https://promisesaplus.com/\n\n\nInstalling\n----------\n```sh\nnpm install promise-defer\n```\n\nPromiseDefer.js follows [semantic versioning](http://semver.org/), so feel\nfree to depend on its major version with something like `>= 1.0.0 < 2`\n(a.k.a `^1.0.0`).\n\n\nUsing\n-----\n```javascript\nvar defer = require(\"promise-defer\")\n\nvar deferred = defer()\ndeferred.resolve(42)\ndeferred.promise // Will eventually be resolved with 42.\n\nvar rejection = defer()\nrejection.reject(new Error(\"I'll have none of that, thank you.\"))\nrejection.promise // Will eventually be rejected with the error.\n```\n\nPromiseDefer.js will use the global ES6 `Promise` constructor by default that's\nstarting to become available in browsers and JavaScript runtimes (e.g. the V8 in\nNode.js v0.11). It doesn't therefore have any outside dependencies.\n\n### Using another Promise implementation\nIf you'd like to use another promise implementation or are running in an\nenvironment that doesn't have the native `Promise`, pass\na [Promises/A+][promisesa+] compatible constructor as the first argument:\n\n```javascript\nvar Bluebird = require(\"bluebird\")\nvar defer = require(\"promise-defer\").bind(null, Bluebird)\ndefer().promise // => An instance of Bluebird.\n```\n\n### Deferred class\nIf you need to programmatically differentiate beteween regular objects and\n`Deferred` instances, use the `instanceof` operator:\n\n```javascript\nvar Deferred = require(\"promise-defer\")\nDeferred() instanceof Deferred // => true\n```\n\n\nLicense\n-------\nPromiseDefer.js is released under a *Lesser GNU Affero General Public License*,\nwhich in summary means:\n\n- You **can** use this program for **no cost**.\n- You **can** use this program for **both personal and commercial reasons**.\n- You **do not have to share your own program's code** which uses this program.\n- You **have to share modifications** (e.g. bug-fixes) you've made to this\n  program.\n\nFor more convoluted language, see the `LICENSE` file.\n\n\nAbout\n-----\n**[Andri Möll][moll]** typed this and the code.  \n[Monday Calendar][monday] supported the engineering work.\n\nIf you find PromiseDefer.js needs improving, please don't hesitate to type to me\nnow at [andri@dot.ee][email] or [create an issue online][issues].\n\n[email]: mailto:andri@dot.ee\n[issues]: https://github.com/moll/js-promise-defer/issues\n[moll]: http://themoll.com\n[monday]: https://mondayapp.com\n","maintainers":[{"name":"moll","email":"andri@dot.ee"}],"time":{"modified":"2022-06-24T18:35:49.368Z","created":"2015-01-18T18:58:40.402Z","1.0.0":"2015-01-18T18:58:40.402Z"},"homepage":"https://github.com/moll/js-promise-defer","keywords":["defer","deferred","promise","promises","unwrap"],"repository":{"type":"git","url":"git://github.com/moll/js-promise-defer.git"},"author":{"name":"Andri Möll","email":"andri@dot.ee","url":"http://themoll.com"},"bugs":{"url":"https://github.com/moll/js-promise-defer/issues"},"readmeFilename":"README.md","users":{"joaquin.briceno":true}}