{"name":"async-task-mgr","version":"1.0.2","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":"cd239d02b056c77795791490b2a46842d30f6784","_id":"async-task-mgr@1.0.2","_shasum":"2dead4814644632e399c6d8ab6736df4c0b06f11","_from":".","_npmVersion":"1.4.23","_npmUser":{"name":"ottomao","email":"ottomao@gmail.com"},"maintainers":[{"name":"ottomao","email":"ottomao@gmail.com"}],"dist":{"shasum":"2dead4814644632e399c6d8ab6736df4c0b06f11","tarball":"http://registry-npm.ywwl.com/async-task-mgr/download/async-task-mgr-1.0.2.tgz","integrity":"sha512-K3ddbTnczmwQamGdZ7XFIdo9Uo0h1o7KXv+8At7J9/ntE7zlwmcf/LNjhfelkNAF1BiAnqtx8GJSBjwJN5rTUA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQC77/Fsd1DdVaeiUZzO/UNtvi4jM8KLulasYT4OKyXjxQIhAKAdpHLC97Zcx7c/2l5U3ci5LedEhjReKcqyZ1WQtr3n"}],"size":1506,"noattachment":false,"key":"/async-task-mgr/-/async-task-mgr-1.0.2.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":1407977753925,"_cnpm_publish_time":1407977753925,"dist-tags":{"latest":"1.1.0"}}