UNPKG

generator-angular-material-fullstack

Version:

Yeoman generator for creating MEAN stack applications, using MongoDB, Express, AngularJS, and Node

24 lines (19 loc) 460 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('thing:save', doc); } function onRemove(socket, doc, cb) { socket.emit('thing:remove', doc); }