{"id":22819480,"url":"https://github.com/bdfoster/nomatic-events","last_synced_at":"2025-08-15T22:14:51.491Z","repository":{"id":58224306,"uuid":"67814926","full_name":"bdfoster/nomatic-events","owner":"bdfoster","description":"Fast, regex-enabled event framework for Node.js","archived":false,"fork":false,"pushed_at":"2020-06-02T00:03:08.000Z","size":5896,"stargazers_count":1,"open_issues_count":6,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-11T00:00:00.573Z","etag":null,"topics":["async","emitter","eventemitter","eventlistener","events","nomatic-events","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bdfoster.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":"2016-09-09T16:32:25.000Z","updated_at":"2019-04-14T17:35:59.000Z","dependencies_parsed_at":"2022-08-31T03:01:28.621Z","dependency_job_id":null,"html_url":"https://github.com/bdfoster/nomatic-events","commit_stats":null,"previous_names":[],"tags_count":30,"template":false,"template_full_name":null,"purl":"pkg:github/bdfoster/nomatic-events","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bdfoster%2Fnomatic-events","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bdfoster%2Fnomatic-events/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bdfoster%2Fnomatic-events/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bdfoster%2Fnomatic-events/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bdfoster","download_url":"https://codeload.github.com/bdfoster/nomatic-events/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bdfoster%2Fnomatic-events/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268158589,"owners_count":24204960,"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","status":"online","status_checked_at":"2025-08-01T02:00:08.611Z","response_time":67,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["async","emitter","eventemitter","eventlistener","events","nomatic-events","typescript"],"created_at":"2024-12-12T15:12:29.872Z","updated_at":"2025-08-01T18:07:48.036Z","avatar_url":"https://github.com/bdfoster.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# nomatic-events\n[![Greenkeeper](https://badges.greenkeeper.io/bdfoster/nomatic-events.svg)](https://greenkeeper.io/)\n[![GitHub Release](https://img.shields.io/github/release/bdfoster/nomatic-events.svg)](https://github.com/bdfoster/nomatic-events/releases)\n[![npm](https://img.shields.io/npm/v/nomatic-events.svg)](https://www.npmjs.com/package/nomatic-events)\n[![Build Status](https://img.shields.io/travis/bdfoster/nomatic-events/master.svg)](https://travis-ci.org/bdfoster/nomatic-events)\n[![Coverage Status](https://img.shields.io/coveralls/bdfoster/nomatic-events/master.svg)](https://coveralls.io/github/bdfoster/nomatic-events)\n[![Known Vulnerabilities](https://snyk.io/test/github/bdfoster/nomatic-events/badge.svg)](https://snyk.io/test/github/bdfoster/nomatic-events)\n[![dependencies Status](https://img.shields.io/david/bdfoster/nomatic-events.svg)](https://david-dm.org/bdfoster/nomatic-events)\n[![devDependencies Status](https://img.shields.io/david/dev/bdfoster/nomatic-events.svg)](https://david-dm.org/bdfoster/nomatic-events?type=dev)\n[![License](https://img.shields.io/github/license/bdfoster/nomatic-events.svg)](https://github.com/bdfoster/nomatic-events/blob/master/LICENSE)\n\n## Installation\n\nYou can install from NPM by doing:\n```\nnpm install --save nomatic-events\n```\n\n## Usage\n\n### Basic\n\n```javascript\nvar events = require(\"nomatic-events\");\nvar EventEmitter = events.EventEmitter;\nvar emitter = new EventEmitter();\n\n// Supports RegExp for listeners \nvar listener = emitter.on(/incoming/i, function(data) {\n  console.log(\"data is now \" + data); \n});\n// `listener` is an EventListener, but you do not have to capture this.\n \nemitter.emit(\"INCOMING\", 42);\n```\n\n### Advanced\n```javascript\nclass EventedObject extends EventEmitter {\n    constructor() {\n        // Call EventEmitter, set maxListeners to 20\n        super(20);\n        \n        this.listenerExecuted = true;\n    }\n    \n    handleIncoming(some, option, or, another) {\n        // Variadic arguments supported\n        this.emit(\"INCOMING\", some, option, or, another);\n    }\n}\n\nlet evented = new EventedObject();\n// Don't have to take every argument supplied by `emit`\nevented.on(/IN/, function(some, option, or) {\n    console.log(this);\n    if (this.listeners) {\n        console.log(some, option, or);\n        this.listenerExecuted = true;\n    } else {\n        console.log(\"Bad context\");\n    }\n});\n\nevented.handleIncoming(\"See no evil\", \"Hear no evil\", \"Speak no evil\", 42);\n// \"See no evil\"\n// \"Hear no evil\"\n// \"Speak no evil\"\n```\n\n## Async\nYou can also use `AsyncEventEmitter` and `AsyncEventListener` to handle Promise-based callbacks.\n### Example\n```javascript\nvar events = require(\"nomatic-events\");\nvar AsyncEventEmitter = events.AsyncEventEmitter;\nvar emitter = new AsyncEventEmitter();\nvar fs = require('fs');\nvar files = null;\nvar listener = emitter.on(/incoming/i, function(data) {\n    return new Promise((resolve, reject) =\u003e {\n        fs.readdir(__dirname, (err, list) =\u003e {\n            if (err) reject(err);\n            files = list;\n            resolve();\n        });\n    })\n});\n// `listener` is an AsyncEventListener, but you do not have to capture this.\n \n// Executed asynchronously \nemitter.emit(\"INCOMING\", 42).then(() =\u003e {\n    // 'files' isn't null!\n    console.log(files);\n});\n// 'files' will still be null until promise resolves\n```\n\n## Testing\nPride is taken when developing tests, you can find unit tests for both EventEmitter and EventListener\n[here](test/unit).\n\n## TypeScript\nThis package is written in TypeScript and declaration files are added to the NPM package.\nHowever, you do not even need to know what TypeScript is in order to use this package,\nlet alone install the compiler. NPM packages include the compiled project.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbdfoster%2Fnomatic-events","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbdfoster%2Fnomatic-events","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbdfoster%2Fnomatic-events/lists"}