first pass at standardizing; suite still passing!
This commit is contained in:
parent
f25c3d33b6
commit
4794385fac
30 changed files with 1454 additions and 1462 deletions
|
@ -1,33 +1,33 @@
|
|||
const EventEmitter = require('events').EventEmitter;
|
||||
const bindings = process.atomBinding('session');
|
||||
const PERSIST_PREFIX = 'persist:';
|
||||
const EventEmitter = require('events').EventEmitter
|
||||
const bindings = process.atomBinding('session')
|
||||
const PERSIST_PREFIX = 'persist:'
|
||||
|
||||
// Returns the Session from |partition| string.
|
||||
exports.fromPartition = function(partition) {
|
||||
exports.fromPartition = function (partition) {
|
||||
if (partition == null) {
|
||||
partition = '';
|
||||
partition = ''
|
||||
}
|
||||
if (partition === '') {
|
||||
return exports.defaultSession;
|
||||
return exports.defaultSession
|
||||
}
|
||||
if (partition.startsWith(PERSIST_PREFIX)) {
|
||||
return bindings.fromPartition(partition.substr(PERSIST_PREFIX.length), false);
|
||||
return bindings.fromPartition(partition.substr(PERSIST_PREFIX.length), false)
|
||||
} else {
|
||||
return bindings.fromPartition(partition, true);
|
||||
return bindings.fromPartition(partition, true)
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// Returns the default session.
|
||||
Object.defineProperty(exports, 'defaultSession', {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return bindings.fromPartition('', false);
|
||||
get: function () {
|
||||
return bindings.fromPartition('', false)
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
var wrapSession = function(session) {
|
||||
var wrapSession = function (session) {
|
||||
// session is an EventEmitter.
|
||||
return session.__proto__ = EventEmitter.prototype;
|
||||
};
|
||||
return session.__proto__ = EventEmitter.prototype
|
||||
}
|
||||
|
||||
bindings._setWrapSession(wrapSession);
|
||||
bindings._setWrapSession(wrapSession)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue