c904ed1b63611ec6ca3a2e30df0e9ac64e2230ab
[motion.git] / server / api / business_condition / business_condition.socket.js
1 /**
2  * Broadcast updates to client when the model changes
3  */
4
5 'use strict';
6
7 var BusinessCondition = require('../../models').BusinessCondition;
8
9 exports.register = function(socket) {
10   BusinessCondition.afterCreate(function (doc) {
11     onSave(socket, doc);
12   });
13   BusinessCondition.afterDestroy(function (doc) {
14     onRemove(socket, doc);
15   });
16 }
17
18 function onSave(socket, doc, cb) {
19   socket.emit('business_condition:save', doc);
20 }
21
22 function onRemove(socket, doc, cb) {
23   socket.emit('business_condition:remove', doc);
24 }