{"id":28398399,"url":"https://github.com/primus/asyncemit","last_synced_at":"2025-06-28T14:31:05.917Z","repository":{"id":29570631,"uuid":"33110097","full_name":"primus/asyncemit","owner":"primus","description":"Asynchronously emit event an event based on the arguments length.","archived":false,"fork":false,"pushed_at":"2023-01-02T20:01:11.000Z","size":30,"stargazers_count":4,"open_issues_count":0,"forks_count":2,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-06-01T13:15:59.688Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/primus.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":"2015-03-30T07:56:22.000Z","updated_at":"2023-01-02T20:01:16.000Z","dependencies_parsed_at":"2023-01-14T15:12:48.973Z","dependency_job_id":null,"html_url":"https://github.com/primus/asyncemit","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/primus/asyncemit","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/primus%2Fasyncemit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/primus%2Fasyncemit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/primus%2Fasyncemit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/primus%2Fasyncemit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/primus","download_url":"https://codeload.github.com/primus/asyncemit/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/primus%2Fasyncemit/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262444707,"owners_count":23312211,"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":"2025-06-01T04:38:39.054Z","updated_at":"2025-06-28T14:31:05.907Z","avatar_url":"https://github.com/primus.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# asyncemit\n\n[![Version npm](http://img.shields.io/npm/v/asyncemit.svg?style=flat-square)](https://www.npmjs.com/package/asyncemit)[![CI](https://img.shields.io/github/actions/workflow/status/primus/asyncemit/ci.yml?branch=master\u0026label=CI\u0026style=flat-square)](https://github.com/primus/asyncemit/actions?query=workflow%3ACI+branch%3Amaster)[![Coverage Status](http://img.shields.io/coveralls/primus/asyncemit/master.svg?style=flat-square)](https://coveralls.io/r/primus/asyncemit?branch=master)\n\nThe `asyncemit` allows you to emit an event to an EventEmitter3 asynchronously.\n\n## Installation\n\nThe module is released in the public npm registry and can be installed using:\n\n```\nnpm install --save asyncemit\n```\n\n## Usage\n\nTo make this pattern work there are a couple of preconditions that need to be\nsatisfied:\n\n1. The method should be added on either a class that inherits from the\n   EventEmitter or on a new EventEmitter instance.\n2. The number of arguments expected by a listener function should match the\n   number of arguments passed to the `asyncemit` method excluding the event\n   name.\n\nSee the following example:\n\n```js\nvar EventEmitter = require('eventemitter3')\n  , asyncemit = require('asyncemit');\n\nvar ee = new EventEmitter();\nee.asyncemit = asyncemit;\n\n//\n// The next `foo` listeners will not be executed until `next` is called.\n//\nee.on('foo', function (arg, next) {\n  // Do things with arg?\n  next();\n});\n\n//\n// Still executed, but synchronously.\n//\nee.on('foo', function (arg) {\n\n});\n\nee.asyncemit('foo', 'bar', function (err) {\n  //\n  // The error argument will be set if one of the async listeners called the\n  // `next` callback with an `error` argument.\n  //\n});\n```\n\n## License\n\n[MIT](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprimus%2Fasyncemit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fprimus%2Fasyncemit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprimus%2Fasyncemit/lists"}