{"id":17855598,"url":"https://github.com/nebrius/taskman","last_synced_at":"2025-04-02T18:15:00.856Z","repository":{"id":21559359,"uuid":"24879112","full_name":"nebrius/taskman","owner":"nebrius","description":"A Node.JS library for managing (possibly) asynchronous operations","archived":false,"fork":false,"pushed_at":"2014-10-07T06:29:03.000Z","size":116,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-04-25T02:25:31.989Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nebrius.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-10-07T06:21:55.000Z","updated_at":"2014-10-25T21:43:30.000Z","dependencies_parsed_at":"2022-08-21T18:21:03.202Z","dependency_job_id":null,"html_url":"https://github.com/nebrius/taskman","commit_stats":null,"previous_names":["bryan-m-hughes/taskman"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nebrius%2Ftaskman","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nebrius%2Ftaskman/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nebrius%2Ftaskman/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nebrius%2Ftaskman/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nebrius","download_url":"https://codeload.github.com/nebrius/taskman/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246866099,"owners_count":20846496,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-28T02:23:44.866Z","updated_at":"2025-04-02T18:15:00.833Z","avatar_url":"https://github.com/nebrius.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"Taskman\n============\n\nTaskman is a node.js library for managing (possibly) asynchronous operations. This library strives to be different from\nother asynchronous operations managers by focusing on the relationships between tasks. Tasks that have no dependencies\nare run first, and tasks that do have dependencies are run as soon as their dependencies have completed.\n\nTo use a task manager, you must first instantiate an instance.\n```javascript\nvar Task = require(\"node-taskman\"),\n\ttask = new Task();\n```\n\nThen you add your tasks in the form of functions. The task function should call either the finish or cancel method passed\nin to it once the task has completed/errored. This will trigger any dependents this task has.\n```javascript\nvar task1 = task.add(function(finish, cancel){\n\tconsole.log(\"I am a task\");\n\tsetTimeout(function(){\n\t\tfinish();\n\t}, 1000);\n});\n```\n\nNext, specify the relationships between the different tasks.\n```javascript\ntask.createDependency(task3, [task1, task2]);\n```\n\nFinally, run and enjoy!\n```javascript\ntask.run(function(){\n\tconsole.log(\"success!\");\n})\n```\n\nYou can instantiate as many taskmans as you want, and can even nest taskmans inside of each other. See ```examples/``` for other interesting ways of using taskman.\n\n# Install\nIn [node.js](http://nodejs.org/) and [npm](http://github.com/isaacs/npm):\n\n\tnpm install taskman\n\n# Methods\n\n## add\n\n### Description\nAdds a task to the manager.\n\n### Signature\n```javascript\ntaskman.add(taskID, dependencies, task)\n```\n\n### Parameters\n* taskID \u003cString\u003e _optional_ The identifier of the task. If ommitted, a task is generated automatically with the form \"@###\".\n* dependencies \u003cString | Array\u003e _optional_\n\t\tThe task ID(s) of the task's dependencies. This is the same as calling taskman.createDependency(task, dependencies).\n* task \u003cfunction(finish, cancel)\u003e The task to add.\n\n### Throws\n* Task ID is already taken.\n* Task is not a function.\n\n### Returns\nThe task ID of the newly created task.\n\n## cancel\n\n### Description\nCancels the run in progress and calls the cancel callback supplied to Taskman#run, if available.\n\n### Signature\n```javascript\ntaskman.cancel(customData)\n```\n\n### Parameters\n* customData \u003cany\u003e _optional_ Data to be passed to the cancel callback.\n\n## clearDependencies\n\n### Description\nClears all of the dependencies for the supplied targets\n\n### Signature\n```javascript\ntaskman.clearDependencies(targets)\n```\n\n### Parameters\n* targets \u003cString | Array\u003e _optional_ The task ID's of the targets to clear the dependencies for. If no targets are specified, all dependencies are cleared.\n\n## createDependency\n\n### Description\nCreates a dependency between two or more tasks\n\n### Signature\n```javascript\ntaskman.createDependency(targets, dependencies)\n```\n\n### Parameters\n* targets \u003cString | Array\u003e The task ID(s) target or targets to create dependencies for. If more than one target is supplied, every dependency specified is set as a dependency of each target.\n* dependencies \u003cString | Array\u003e The task ID(s) of the dependency or dependencies of the targets.\n\n### Throws\n* Unsupported targets type. The targets parameter is not a string or an array.\n* Unsupported dependencies type. The dependencies parameter is not a string or an array.\n\n## reset\n\n### Description\nResets the task so that it can be used again. All registered tasks and dependencies are discarded.\n\n### Signature\n```javascript\ntaskman.reset()\n```\n\n## run\n\n### Description\nRuns the scheduled tasks. Any changes to the dependencies after this method is called are ignored.\n\n### Signature\n```javascript\ntaskman.run(serializeTasksFlag, completion, cancel)\n```\n\n### Parameters\n* serializeTasksFlag \u003cBoolean\u003e Convienience flag that calls Taskman@serializeTasks under the hood\n* completion \u003cfunction()\u003e The function to call once all tasks have completed successfully\n* cancel \u003cfunction(customData)\u003e The function to call if one of the tasks calls Taskman#cancel or its cancel function. The data passed in to Taskman#cancel is supplied as the argument to this function.\n\n## serializeTasks\n\n### Description\nAutomatically creates a dependency between every task such that the next task does not run until the task before it has completed. Any tasks added after this method is called are not serialized.\n\n### Signature\n```javascript\ntaskman.serializeTasks()\n```\n\n# License\nCopyright 2012-2013 Bryan Hughes \u003cbryan@theoreticalideations.com\u003e\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n    http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnebrius%2Ftaskman","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnebrius%2Ftaskman","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnebrius%2Ftaskman/lists"}