{"name":"async-task-mgr","version":"1.0.0","description":"A simple nodeJS module for async task manager. Identical tasks will be executed only once and the result will be saved for further use.","main":"index.js","scripts":{"test":"test.js"},"repository":{"type":"git","url":"https://github.com/ottomao/async-task-mgr.git"},"keywords":["async","task","manager"],"author":{"name":"Otto Mao","email":"ottomao@gmail.com","url":"http://ottomao.com/"},"license":"ISC","bugs":{"url":"https://github.com/ottomao/async-task-mgr/issues"},"homepage":"https://github.com/ottomao/async-task-mgr","gitHead":"06be61707aea29111c75d7e9f9e2c5257c4b0968","_id":"async-task-mgr@1.0.0","_shasum":"ac1f7d6947c682c26713304d46e641783f6b17c8","_from":".","_npmVersion":"1.4.23","_npmUser":{"name":"ottomao","email":"ottomao@gmail.com"},"maintainers":[{"name":"ottomao","email":"ottomao@gmail.com"}],"dist":{"shasum":"ac1f7d6947c682c26713304d46e641783f6b17c8","tarball":"http://registry-npm.ywwl.com/async-task-mgr/download/async-task-mgr-1.0.0.tgz","integrity":"sha512-G4Xr40LCKr3Kpqr2UrDRc/vRCBxx87Qe2h/2d73gYvrklT8trB8ZP8eITy8ySUz/2O4KRcE9VWYi2F9e3Pfqfg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGzOAGWktbNTgSn7IA3xlBjM9wSvKnEAJrrAgrtROEe2AiBVk1b3OwiqzKU5iQprmL/QKSeKN/7Bcq/ZpA+BTpC3mA=="}],"size":1501,"noattachment":false,"key":"/async-task-mgr/-/async-task-mgr-1.0.0.tgz"},"directories":{},"readme":"async-task-mgr\n==============\n\n## Intro\nA simple nodeJS module for async task manager. Identical tasks will be executed only once and the result will be saved for further use.\n\n## Features\n\n* tasks with the same name are identified as **the same**, and will be executed only once\n* task result will be saved for further use\n\n\n## How to use\n\n``npm install async-task-mgr --save``\n\n## Sample\n```javascript\nvar asyncTask = require(\"async-task-mgr\");\n\nvar asyncTaskInstance = new asyncTask();\n\nfunction taskAction(callback){\n\tsetTimeout(function(){ //simulate an async task\n\t\tvar resultA = Math.floor(Math.random()*100),\n\t\t\tresultB = Math.floor(Math.random()*100),\n\t\t\tresultC = Math.floor(Math.random()*100);\n\n\t\tcallback(resultA, resultB, resultC);\n\t},2000); \n}\n\n//add a new task named task_A\n//when taskAction is done, its return value will be saved and apply to all the task with the same name\nasyncTaskInstance.addTask(\"task_A\",taskAction,function(resultA,resultB,resultC){ \n\tconsole.log(\"task A_1 result :\" + resultA + \" \" + resultB + \" \" + resultC); //all result generated by taskAction will be passed here\n});\n\n\n//add a new task named task_A\n/*\nsince a task with the same name has been added, this taskAction will not be executed.\nthe callback function will be put in a queue and will be called when previous callbacks are done.\n*/\nasyncTaskInstance.addTask(\"task_A\",taskAction,function(resultA,resultB,resultC){\n\tconsole.log(\"task A_2 result :\" + resultA + \" \" + resultB + \" \" + resultC);\n});\n\n\n//add a new task named task_X\n//a new task, have no relationship to the previous ones\nasyncTaskInstance.addTask(\"task_X\",taskAction,function(resultA,resultB,resultC){\n\tconsole.log(\"task X_0 result :\" + resultA + \" \" + resultB + \" \" + resultC);\n});\n\n```\n\n## Author\nOtto Mao \nottomao@gmail.com","publish_time":1407914580876,"_cnpm_publish_time":1407914580876,"dist-tags":{"latest":"1.1.0"}}