https://github.com/rubenmoya/emitter
A small event emitter with typescript
https://github.com/rubenmoya/emitter
Last synced: 4 months ago
JSON representation
A small event emitter with typescript
- Host: GitHub
- URL: https://github.com/rubenmoya/emitter
- Owner: rubenmoya
- License: mit
- Created: 2017-12-09T21:43:07.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-05-30T13:45:33.000Z (about 7 years ago)
- Last Synced: 2024-12-29T10:44:10.146Z (6 months ago)
- Language: TypeScript
- Size: 43 KB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Emitter
A small event emitter with typescript```js
import Emitter from 'emitter'const emitter = new Emitter()
// Listen to an event
emitter.on('myEvent', event => console.log('myEvent:', event) )// Fire an event
emitter.emit('myEvent', { a: 'b' })// Working with handler references:
function onEvent() {}
emitter.on('myEvent', onEvent) // listen
emitter.off('myEvent', onEvent) // unlisten
```