Last active
December 25, 2015 14:09
-
-
Save alexindigo/6988693 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// saves data to db | |
Chat.prototype.save = function Chat_save(channel, key, value, callback) | |
{ | |
var _chat = this; | |
this._db.put(channel+':'+key, value, function(err) | |
{ | |
if (err) return callback(err); | |
// update local | |
_chat[channel][key] = value; | |
return callback(null); | |
}); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
level(filename, {keyEncoding: 'utf8', valueEncoding: 'json'}, function(err, db) | |
{ | |
if (err) return callback(err); | |
_chat._db = db; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment