Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/socker210/event-emitter
A simple event emitter
https://github.com/socker210/event-emitter
Last synced: about 1 month ago
JSON representation
A simple event emitter
- Host: GitHub
- URL: https://github.com/socker210/event-emitter
- Owner: socker210
- License: mit
- Created: 2018-12-13T06:58:10.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2022-12-09T16:13:46.000Z (about 2 years ago)
- Last Synced: 2024-12-13T05:37:56.541Z (about 1 month ago)
- Language: JavaScript
- Size: 637 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 15
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Event emitter
Simple event emitter like a node
## Installation
With npm
```
npm install @socker210/event-emitter
```With yarn
```
yarn add @socker210/event-emitter
```## Usage
```javascript
const EventEmitter = require('@socker210/event-emitter')const eventEmitter = new EventEmitter()
const cb = () => console.log('callback')
// Register event
eventEmitter.on('print', cb)// Execute event
eventEmitter.emit('print')// Check if event is registered
eventEmitter.hasEvent('print')// Check if event and callback is registered
eventEmitter.hasCallback('print', cb)// Remove callback
eventEmitter.off('print', cb)
```## LICENSE
MIT