UNPKG

json-object-editor

Version:

JOE the Json Object Editor | Platform Edition

25 lines (24 loc) 744 B
//NOT READY YET function Comments() { var self = this; var dbname = 'comments'; this.add = function(data,callback,socket){ JOE.Storage.save(data,dbname,function(err,data){ //console.log('comment item: '+data.item._id); if(socket){ socket.emit('comments_updated',{itemid:data.item._id}); socket.broadcast.emit('comments_updated',{itemid:data.item._id}); } },{history:false}); }; this.get = function(query){ }; this.userid = function(userid){ JOE.Storage.load(dbname,{}) }; this.itemid = function(itemid){ JOE.Storage.load(dbname,{itemid:itemid}) }; return this; } module.exports = new Comments();