{"_id":"future","_rev":"19-fe61480ed348e6c637e8d3a628146a8d","name":"future","description":"The promise / subscribe / deferred module of FuturesJS (Ender.JS and Node.JS)","dist-tags":{"latest":"2.3.1"},"versions":{"2.1.1":{"name":"future","version":"2.1.1","description":"The promise / subscribe / deferred module of FuturesJS (Ender.JS and Node.JS)","homepage":"https://github.com/coolaj86/futures","keywords":["flow-control","async","asynchronous","futures","promises","deferreds","util","browser"],"repository":{"type":"git","url":"git://github.com/coolaj86/futures.git"},"author":{"name":"AJ ONeal","email":"coolaj86@gmail.com","url":"http://coolaj86.info"},"main":"future.js","directories":{"lib":"."},"dependencies":{},"engines":{"node":"*"},"_npmJsonOpts":{"file":"/Users/coolaj86/.npm/future/2.1.1/package/package.json","wscript":false,"contributors":false,"serverjs":false},"_id":"future@2.1.1","devDependencies":{},"_engineSupported":true,"_npmVersion":"1.0.15","_nodeVersion":"v0.4.8","_defaultsLoaded":true,"dist":{"shasum":"0e395c1dd26925d72c4f57b079269a0457316eff","tarball":"https://registry.npmjs.org/future/-/future-2.1.1.tgz","integrity":"sha512-DiciQvwvJCkF5hzq4oPaNWUVjKTQe/BzZ3poiq7YY1KF5jHm/Y03sf/n1Zf4S3KIaKR0J0k/t1D5vG8uyjrhFQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCNdfO39kHgOjWhpFe4l9HU7xTwsoIDpCbWwGRvbNJweQIhAOCebhZQDlQMkirKW1SZh0c9PGiVq9sdFowzHpk45Tq1"}]},"scripts":{}},"2.2.0":{"name":"future","version":"2.2.0","description":"The promise / subscribe / deferred module of FuturesJS (Ender.JS and Node.JS)","homepage":"https://github.com/coolaj86/futures","keywords":["flow-control","async","asynchronous","futures","promises","deferreds","util","browser"],"repository":{"type":"git","url":"git://github.com/coolaj86/futures.git"},"author":{"name":"AJ ONeal","email":"coolaj86@gmail.com","url":"http://coolaj86.info"},"main":"future.js","directories":{"lib":"."},"dependencies":{},"engines":{"node":"*","ender":">= 0.5.0"},"_npmUser":{"name":"coolaj86","email":"coolaj86@gmail.com"},"_id":"future@2.2.0","devDependencies":{},"_engineSupported":true,"_npmVersion":"1.1.0-beta-10","_nodeVersion":"v0.6.7","_defaultsLoaded":true,"dist":{"shasum":"183f827263509569ac32f3b52ead0ad490cb21dd","tarball":"https://registry.npmjs.org/future/-/future-2.2.0.tgz","integrity":"sha512-hf8dNAqIXnUL0O4b4rJkXu1HyIMfcwhWx8TU9haI+9zahtHEej09wnEMNXngv0PKLPm7NnNeuRcSHa/Xhf1WLg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQC2ECC6HwiB3CLAItolDo4pD3QcKvJtpla4qYA58TMWAwIhAIO+5Dvur6X+Fuf5YGF2s89fK9DCo1k4y5LGWFrh6ne1"}]},"readme":"Future\n----\n\nCreates a Future (aka Promise, Deferred, Subscription, Callback) object.\n\nInstallation\n---\n\nNode.JS (Server):\n\n    npm install future\n\nEnder.JS (Browser):\n\n    ender build future\n\nUsage\n---\n\n    var context = { \"foo\": \"bar\" }\n      , Future = require('future')\n      , future = Future(context)\n      , err\n      , message = \"Hello World!\"\n      ;\n\n    future.whenever(function (error, data) {\n      if (error) {\n        throw err;\n      }\n      console.log(this.foo + \" says: \" + data);\n    });\n\n    future.setTimeout(100);\n    future.deliver(err, message);\n\nOutput:\n\n    \"bar says: Hello World\"\n    FutureTimeout: timeout 100ms\n        at [object SomeObject]:x:y\n        ...\n\nAPI\n---\n\n**Core**\n\n  * `Futures.future(globalContext=null)` - creates a `Future` object and uses `globalContext` as the default `this` for callbacks\n\n  * `deliver(err, data, ...)` - Send a message (data) to all listeners (callbacks)\n\n  * `fulfill([err, data, ...])` - Prevent the sending of any future messages. If arguments are passed they will be `deliver`ed.\n\n  * `whenever(callback, [context])` - Listen to all messages, applying `context` if provided (passing `null` cancels `globalContext`)\n\n  * `when(callback, [context])` - Listen one-time only, then `removeCallback` automatically\n\n  * `setTimeout(ms)` - will sends a `FutureTimeout` error if no activity occurs within `ms`\n\n\n**Accessory**\n\n  * `errback(err)` - Useful for a peer-library requiring a method specifically for errbacks\n    * i.e. `jQuery`'s `$.ajax`\n\n  * `callback(data [, ...])` - Useful for a peer-library requiring a method which does not pass `err` as the first parameter\n    * i.e. `jQuery`'s `$.ajax`\n\n  * `removeCallback(callback, context=null)` - This callback and associated context will no longer receive messages\n\n  * `setAsap(on=true)` - New listeners get existing data (if available) rather than waiting until the next delivery (default on)\n\n  * `isFuture(obj)` - a best-effort guess as to whether or not an object is a Future\n\n  * `callbackCount(callback, context)` - The number of listening callbacks\n\n  * `deliveryCount(callback, context)` - The number of deliveries made\n\n  * `hasCallback(callback, context=null)` - Returns `true` if the callback is listening\n","maintainers":[{"name":"coolaj86","email":"coolaj86@gmail.com"}]},"2.3.1":{"name":"future","version":"2.3.1","description":"The promise / subscribe / deferred module of FuturesJS (Ender.JS and Node.JS)","homepage":"https://github.com/coolaj86/futures","keywords":["flow-control","async","asynchronous","futures","promises","deferreds","util","browser"],"repository":{"type":"git","url":"git://github.com/coolaj86/futures.git"},"author":{"name":"AJ ONeal","email":"coolaj86@gmail.com","url":"http://coolaj86.info"},"main":"future.js","directories":{"lib":"."},"dependencies":{},"engines":{"node":"*","ender":">= 0.5.0"},"_npmUser":{"name":"coolaj86","email":"coolaj86@gmail.com"},"_id":"future@2.3.1","devDependencies":{},"optionalDependencies":{},"_engineSupported":true,"_npmVersion":"1.1.21","_nodeVersion":"v0.6.18","_defaultsLoaded":true,"dist":{"shasum":"2d327e0611dd56fac7112d057c799c485ec23be9","tarball":"https://registry.npmjs.org/future/-/future-2.3.1.tgz","integrity":"sha512-VUHZhrdSGrSro2V2hJZD4ZalTUk3RYhOvaVjsu9N7fC7O1rmKO2jWO43JliA5FMnoi97wMAtXClo5QpJ71rExg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIAiU2Yux9quywB9Zg8SIj/LPq6tKERfKY33e1lNqVNCCAiEAjJFpzTpSje1jgW0QXNQJsFD7gbasovm7Sg1Wi8vG+KE="}]},"readme":"Future\n----\n\nCreates a Future (aka Promise, Deferred, Subscription, Callback) object.\n\nInstallation\n---\n\nNode.JS (Server):\n\n    npm install future\n\nEnder.JS (Browser):\n\n    ender build future\n\nUsage\n---\n\n    var context = { \"foo\": \"bar\" }\n      , Future = require('future')\n      , future = Future.create(context)\n      , err\n      , message = \"Hello World!\"\n      ;\n\n    future.whenever(function (error, data) {\n      if (error) {\n        throw err;\n      }\n      console.log(this.foo + \" says: \" + data);\n    });\n\n    future.setTimeout(100);\n    future.deliver(err, message);\n\nOutput:\n\n    \"bar says: Hello World\"\n    FutureTimeout: timeout 100ms\n        at [object SomeObject]:x:y\n        ...\n\nAPI\n---\n\nCreates a Future (aka Promise, Deferred, Subscription, Callback) object.\n\n**Core**\n\n  * `Futures.future(globalContext=null)` - creates a `Future` object and uses `globalContext` as the default `this` for callbacks\n\n  * `deliver(err, data, ...)` - Send a message (data) to all listeners (callbacks)\n\n  * `fulfill([err, data, ...])` - Prevent the sending of any future messages. If arguments are passed they will be `deliver`ed.\n\n  * `whenever(callback, [context])` - Listen to all messages, applying `context` if provided (passing `null` cancels `globalContext`)\n\n  * `when(callback, [context])` - Listen one-time only, then `removeCallback` automatically\n\n  * `setTimeout(ms)` - will sends a `FutureTimeout` error if no activity occurs within `ms`\n\n\n**Accessory**\n\n  * `errback(err)` - Useful for a peer-library requiring a method specifically for errbacks\n    * i.e. `jQuery`'s `$.ajax`\n\n  * `callback(data [, ...])` - Useful for a peer-library requiring a method which does not pass `err` as the first parameter\n    * i.e. `jQuery`'s `$.ajax`\n\n  * `removeCallback(callback, context=null)` - This callback and associated context will no longer receive messages\n\n  * `setAsap(on=true)` - New listeners get existing data (if available) rather than waiting until the next delivery (default on)\n\n  * `isFuture(obj)` - a best-effort guess as to whether or not an object is a Future\n\n  * `callbackCount(callback, context)` - The number of listening callbacks\n\n  * `deliveryCount(callback, context)` - The number of deliveries made\n\n  * `hasCallback(callback, context=null)` - Returns `true` if the callback is listening\n\n\nExample\n---\n\n    var context = { \"foo\": \"bar\" },\n      future = Futures.future(context),\n      err,\n      message = \"Hello World!\";\n\n    future.whenever(function (error, data) {\n      if (error) {\n        throw err;\n      }\n      console.log(this.foo + \" says: \" + data);\n    });\n\n    future.setTimeout(100);\n    future.deliver(err, message);\n\nOutput:\n\n    \"bar says: Hello World\"\n    FutureTimeout: timeout 100ms\n        at [object SomeObject]:x:y\n        ...\n\n","maintainers":[{"name":"coolaj86","email":"coolaj86@gmail.com"}]}},"maintainers":[{"name":"coolaj86","email":"coolaj86@gmail.com"}],"time":{"modified":"2022-06-18T04:27:37.859Z","created":"2011-07-13T20:13:36.863Z","2.1.1":"2011-07-13T20:13:37.233Z","2.2.0":"2012-01-22T06:13:42.153Z","2.3.1":"2012-05-31T15:34:39.781Z"},"author":{"name":"AJ ONeal","email":"coolaj86@gmail.com","url":"http://coolaj86.info"},"repository":{"type":"git","url":"git://github.com/coolaj86/futures.git"},"users":{"jwjb":true,"huytard":true,"allenfuller":true}}