UNPKG

slush-y

Version:

A slush generator for Best Practices with AngularJS Fullstack applications.

24 lines (19 loc) 462 B
/** * Broadcast updates to client when the model changes */ 'use strict'; var thing = require('./thing.model'); exports.register = function(socket) { thing.schema.post('save', function (doc) { onSave(socket, doc); }); thing.schema.post('remove', function (doc) { onRemove(socket, doc); }); } function onSave(socket, doc, cb) { socket.emit('things:save', doc); } function onRemove(socket, doc, cb) { socket.emit('things:remove', doc); }