transform and pass through the existing store

This commit is contained in:
ansuz 2016-05-14 12:51:52 +02:00
parent a08efc568b
commit 061cffe462
1 changed files with 7 additions and 6 deletions

View File

@ -8,11 +8,12 @@ var create = module.exports.create = function(filePath, backingStore) {
var file = Fs.createWriteStream(filePath, {flags: 'a+'});
return {
message: function(channel, msg, callback) {
message(file, msg);
backingStore.message(channel, msg, callback);
},
getMessages: backingStore.getMessages
var originalMessageFunction = backingStore.message;
backingStore.message = function(channel, msg, callback) {
message(file, msg);
originalMessageFunction(channel, msg, callback);
};
return backingStore;
};