mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-21 07:56:16 -04:00
SessionStore: Use EC6 class syntax
This fixes a minor bug where the SessionStore constructor did not call the base class constructor.
This commit is contained in:
parent
0504e07eb4
commit
bee91a0bd1
1 changed files with 25 additions and 27 deletions
|
@ -13,11 +13,8 @@ const log4js = require('ep_etherpad-lite/node_modules/log4js');
|
||||||
|
|
||||||
const logger = log4js.getLogger('SessionStore');
|
const logger = log4js.getLogger('SessionStore');
|
||||||
|
|
||||||
const SessionStore = module.exports = function SessionStore() {};
|
module.exports = class SessionStore extends Store {
|
||||||
|
get(sid, fn) {
|
||||||
SessionStore.prototype.__proto__ = Store.prototype;
|
|
||||||
|
|
||||||
SessionStore.prototype.get = function(sid, fn) {
|
|
||||||
logger.debug('GET ' + sid);
|
logger.debug('GET ' + sid);
|
||||||
db.get('sessionstorage:' + sid, (err, sess) => {
|
db.get('sessionstorage:' + sid, (err, sess) => {
|
||||||
if (sess) {
|
if (sess) {
|
||||||
|
@ -32,16 +29,17 @@ SessionStore.prototype.get = function(sid, fn) {
|
||||||
fn();
|
fn();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
}
|
||||||
|
|
||||||
SessionStore.prototype.set = function(sid, sess, fn) {
|
set(sid, sess, fn) {
|
||||||
logger.debug('SET ' + sid);
|
logger.debug('SET ' + sid);
|
||||||
db.set('sessionstorage:' + sid, sess);
|
db.set('sessionstorage:' + sid, sess);
|
||||||
if (fn) process.nextTick(fn);
|
if (fn) process.nextTick(fn);
|
||||||
};
|
}
|
||||||
|
|
||||||
SessionStore.prototype.destroy = function(sid, fn) {
|
destroy(sid, fn) {
|
||||||
logger.debug('DESTROY ' + sid);
|
logger.debug('DESTROY ' + sid);
|
||||||
db.remove('sessionstorage:' + sid);
|
db.remove('sessionstorage:' + sid);
|
||||||
if (fn) process.nextTick(fn);
|
if (fn) process.nextTick(fn);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue