https://github.com/ezra-obiwale/dpd-emitter
Emit events for collection CRUD operations on Deployd
https://github.com/ezra-obiwale/dpd-emitter
deployd emit emitter event module socket-io
Last synced: 4 months ago
JSON representation
Emit events for collection CRUD operations on Deployd
- Host: GitHub
- URL: https://github.com/ezra-obiwale/dpd-emitter
- Owner: ezra-obiwale
- License: mit
- Created: 2017-07-05T06:08:18.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2017-07-05T08:51:52.000Z (almost 9 years ago)
- Last Synced: 2025-09-12T22:27:53.989Z (9 months ago)
- Topics: deployd, emit, emitter, event, module, socket-io
- Language: JavaScript
- Homepage:
- Size: 2.93 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# dpd-emitter
Emit events for collection CRUD operations on Deployd
## Installation
```bash
npm install dpd-emitter --save
```
## Events
Events `created`, `updated` and `deleted` are emitted when models are created,
updated and deleted respectively.
## Event Data
The model object operated on is always sent along with the events.
## Usage
```javascript
var socket = io('http://localhost:2403'); // Change the url as seen fit
// watch new models
socket.on(':created', function(model) {
// do something with model
});
// watch all updated models
socket.on(':updated', function(model) {
// do something with model
});
// watch updates on a particular model
socket.on(':updated:', function(model) {
// do something with model
});
// watch all deleted models
socket.on(':deleted', function(model) {
// do something with model
});
// watch when a particular model is deleted
socket.on(':deleted:', function(model) {
// do something with model
});
```