https://github.com/rubenmoya/mity
https://github.com/rubenmoya/mity
Last synced: 4 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/rubenmoya/mity
- Owner: rubenmoya
- Created: 2017-12-29T17:23:30.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-12-29T17:43:57.000Z (over 7 years ago)
- Last Synced: 2024-12-29T10:44:13.478Z (5 months ago)
- Size: 1000 Bytes
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# mity
> Yet another event emitter
### INSTALL AND USE mity
mity is registered as an Node package with NPM. You can install the latest version of mity with the command:
```js
npm install mity
```If you want to use mity you can import it with:
```js
const Mity = require('mity');
```### DEFINING mity CHANNELS
```js
const UsersChannel = Mitter.channel('users');
const NotificationsChannel = Mitter.channel('notifications');
```### USING mity CHANNELS
```js
UsersChannel
.suscribe({
fetched: (users) => console.log('Users fetched:', users),
error: (error) => NotificationsChannel.dispatch('error', error)
})
.suscribeOnce({
fetch: () => console.log('Fetching users...')
});
``````js
UsersChannel.unsuscribe('fetched');
``````js
UsersChannel.dispatch('fetch');
```## License
[MIT License](https://opensource.org/licenses/MIT) © [Rubén Moya](http://rubenmoya.com/)