{"id":18096819,"url":"https://github.com/bredele/async","last_synced_at":"2025-04-06T03:27:46.068Z","repository":{"id":15753617,"uuid":"18492334","full_name":"bredele/async","owner":"bredele","description":"Collection of asynchronous patterns for nodejs and your browser.","archived":false,"fork":false,"pushed_at":"2014-04-25T18:52:22.000Z","size":208,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-12T09:54:29.547Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://bredele.github.io/async","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bredele.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-04-06T15:21:55.000Z","updated_at":"2014-12-12T00:56:32.000Z","dependencies_parsed_at":"2022-09-18T00:01:31.365Z","dependency_job_id":null,"html_url":"https://github.com/bredele/async","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bredele%2Fasync","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bredele%2Fasync/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bredele%2Fasync/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bredele%2Fasync/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bredele","download_url":"https://codeload.github.com/bredele/async/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247430675,"owners_count":20937871,"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-31T19:15:33.832Z","updated_at":"2025-04-06T03:27:46.050Z","avatar_url":"https://github.com/bredele.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"async\n====\n\n  A place to put together clean and simple asynchronous patterns for nodejs and your browser.\n\n## Emitter\n\n  \u003e observer\n\n  **[emitter](http://github.com/component/component)** is a module made by the team [component](http://github.com/component). \n\n```js\nvar emitter = new Emitter();\nemitter.on('changed', function() {\n\t// do something on changed\n});\nemitter.emit('changed');\n```\n\n\u003c!--   Emitter is from far the module I use the most. It is clean, simple, can be used on nodejs instead [EventEmitter](http://nodejs.org/api/events.html)  --\u003e\n\u003c!-- \n  Here's some projects related: --\u003e\n\n\n## Promises\n\n  \u003e promise\n\n  **[promise](http://github.com/bredele/promise)** is a promise A+ [implementation](http://promises-aplus.github.io/promises-spec/).\n\n```js\nvar promise = new Promise();\npromise.then(function(value) {\n\t\n});\npromise.resolve('because');\n```\n\n## Mood\n\n  \u003e finite state machine\n\n  **[mood](https://github.com/bredele/mood)** is a finite state machine based on [emitter](http://github.com/component/emitter). It allows you to define transitions from one state to an other.\n\n```js\nvar states = new Mood('open');\n\n// transition open to locked\nstates.add('open','lock', function() {\n  //do something\n}, 'locked');\n\nstates.emit('lock');\n```\n\n## Queue\n\n  \u003e asynchronous emitter\n\n  **[queue](http://github.com/bredele/emitter-queue)** is a plugin for [emitter](http://github.com/component/emitter) and **[datastore](http://github.com/bredele/datastore)** that allows to listen events even after they have been fired.\n\n```js\nvar emitter = new Emitter();\nQueue(emitter);\n\nemitter.queue('changed');\nemitter.on('changed', function() {\n\t// do something on changed\n});\n```\n\n## Door\n\n  \u003e door pattern\n\n  **[door](https://github.com/bredele/doors)** is a design pattern I invented. \n\n\n```js\nvar door = new Door('awesome');\ndoor.lock('foo');\ndoor.lock('bar');\n\ndoor.on('open', function() {\n\t// do something when every lock are unlocked\n});\n\ndoor.unlock('bar', 'foo');\n```\n\n  A door has two states (opened and closed) and can switch from one to an other indefinitely. Doors is the opposite of a finite state machine, a transition is trigerred by one or several conditions (or locks). To be opened, a door needs to unlock all locks and one lock is enough to close the door.\n\n\u003c!--   dire pourquoi c'est bien  --\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbredele%2Fasync","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbredele%2Fasync","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbredele%2Fasync/lists"}