Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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: 3 days ago
JSON representation

Emit events for collection CRUD operations on Deployd

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
});
```