{"dist":{"shasum":"a3dfc8303c86e0d805d98283d4c08d8d649e420a","tarball":"https://registry.npmjs.org/join/-/join-2.3.1.tgz","integrity":"sha512-SC4t+SjKyyvCgY1Xsi25UeDo972KSokDT7ggwP15PDknNzSkaFiqNpUY39LuXREG0I3l8wlbPM3rNz7/swWu2w==","signatures":[{"sig":"MEQCIDwV/IO24eFIphtgMJgqGVAgeB3fTXi7W6QnoLCaaxFGAiAr4NeK29nhgtiK9le4yfYdqLxjKK1Ajnwjl7h9JPb+tg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"join.js","name":"join","author":{"url":"http://coolaj86.info","name":"AJ ONeal","email":"coolaj86@gmail.com"},"readme":"Join\n===\n\nJoins asynchronous calls together similar to how `pthread_join` works for threads.\n\nInstallation\n---\n\nNode.JS (Server):\n\n    npm install join\n\nEnder.JS (Browser):\n\n    ender build join\n\nStandalone Usage\n---\n\n    var Join = require('join')\n      , join = Join.create()\n      , callbackA = join.add()\n      , callbackB = join.add()\n      , callbackC = join.add()\n      ;\n\n    function abcComplete(aArgs, bArgs, cArgs) {\n      console.log(aArgs[1] + bArgs[1] + cArgs[1]);\n    }\n\n    setTimeout(function () {\n      callbackA(null, 'Hello');\n    }, 300);\n\n    setTimeout(function () {\n      callbackB(null, 'World');\n    }, 500);\n\n    setTimeout(function () {\n      callbackC(null, '!');\n    }, 400);\n\n\n    // this must be called after all \n    join.when(abcComplete);\n\nUsage with Futures\n---\n\n    var Future = require('futures')\n      , join = require('join').create()\n      , fArray = [\n            Future.create()\n          , Future.create()\n          , Future.create()\n        ]\n      , e\n      ;\n\n    setTimeout(function () { fArr[1].deliver(e, \"World\"); }, 100);\n    setTimeout(function () { fArr[0].deliver(e, \"Hi\"); }, 300);\n    setTimeout(function () { fArr[0].deliver(e, \"Hello\"); }, 500);\n    setTimeout(function () { fArr[2].deliver(e, \"!\", \"!\"); }, 700);\n\n    // * join.add() -- creates a callback that you can pass in to another function\n    //\n    //    $.get('/xyz.json', join.add());\n\n    // * join.add(<future>) -- adds a single future\n    //\n    //    var f1 = Future.create()\n    //      , f2 = Future.create()\n    //      ;\n    //    join.add(f1, f2); // or join.add(f1).add(f2);\n\n    // * join.add([<future>, ...]) -- adds an array of futures\n    //\n    //   join.add(fArr);\n\n    join.add(fArr);\n    join.when(function (f0Args, f1Args, f2Args) {\n      console.log(f1Args[1], f2Args[1], f3Args[1], f2Args[2]);\n    });\n\nAPI\n---\n\nCreates a Future-ish object for the purpose of synchronizing other Futures.\n\n**Core**\n\n  * `join = Join.create(globalContext=null)` - create a Future and modifies it\n  * `join.add()` - creates a joinable callback that you can throw around\n  * `join.add(future0, future1, ...)` - add one or more `Future`s which to join\n  * `join.add([future0, future2, ...])` - add an array of `Future`s\n  * `join.when(finalCallback)`\n    * Fires `finalCallback` when all joined callbacks have completed\n    * Must be called after the last `add()`\n    * See `Future#when`\n  * `join.whenever(eventCallback)`\n    * Fires `eventCallback` each time all callbacks have completed at least once\n    * Must be called after the last `add()`\n    * see `Future#whenever`\n  * `join.isJoin` - a best-effort guess as to whether or not an object is a Join\n\n**Inherited-ish**\n\n  * `when` - see `Future#when`\n  * `whenever` - see `Future#whenever`\n\nNote: All `add(future)`s must be done before calling `when` or `whenever` on the join object.\n","engines":{"node":"*","ender":">= 0.5.0"},"_npmUser":{"name":"coolaj86","email":"coolaj86@gmail.com"},"homepage":"https://github.com/coolaj86/futures","keywords":["flow-control","async","asynchronous","futures","promises","deferreds","join","synchronize","util","browser"],"repository":{"url":"git://github.com/coolaj86/futures.git","type":"git"},"_npmVersion":"1.1.21","description":"The join / synchronize module of FuturesJS (Ender.JS and Node.JS)","directories":{"lib":"."},"maintainers":[{"name":"coolaj86","email":"coolaj86@gmail.com"}],"_nodeVersion":"v0.6.18","dependencies":{"future":">= 2.3.1"},"_defaultsLoaded":true,"devDependencies":{},"_engineSupported":true,"optionalDependencies":{},"_id":"join@2.3.1","version":"2.3.1"}