Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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: about 2 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 (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-07-05T08:51:52.000Z (over 7 years ago)
- Last Synced: 2024-11-15T04:14:43.457Z (2 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
});
```