make amnesiadb compatible with netflux

pull/1/head
ansuz 9 years ago
parent be1ef7abe3
commit e83e5026ce

@ -18,6 +18,7 @@ module.exports.create = function(conf, cb){
var db=[],
index=0;
cb({
message: function(channelName, content, cb){
var val = {
@ -27,17 +28,18 @@ module.exports.create = function(conf, cb){
time: new Date().getTime(),
};
db.push(val);
cb();
if (cb) { cb(); }
},
getMessages: function(channelName, cb){
getMessages: function(channelName, handler, cb){
db.sort(function(a,b){
return a.id - b.id;
});
db.filter(function(val){
return val.chan === channelName;
}).forEach(function(doc){
cb(doc.msg);
handler(doc.msg);
});
if (cb) { cb(); }
},
});
};

Loading…
Cancel
Save