2016-06-01 10:42:24 +09:00
|
|
|
const {EventEmitter} = require('events')
|
2016-07-12 20:06:08 +09:00
|
|
|
const {app} = require('electron')
|
2016-07-12 20:21:59 +09:00
|
|
|
const {fromPartition, _setWrapSession} = process.atomBinding('session')
|
2016-06-01 10:42:24 +09:00
|
|
|
|
2016-01-14 10:35:29 -08:00
|
|
|
// Returns the default session.
|
2016-07-12 21:01:49 +09:00
|
|
|
Object.defineProperties(exports, {
|
|
|
|
defaultSession: {
|
|
|
|
enumerable: true,
|
|
|
|
get () { return fromPartition('') }
|
|
|
|
},
|
|
|
|
fromPartition: {
|
|
|
|
enumerable: true,
|
|
|
|
value: fromPartition
|
2016-01-11 18:40:23 -08:00
|
|
|
}
|
2016-03-24 13:15:04 -07:00
|
|
|
})
|
2016-06-01 10:42:24 +09:00
|
|
|
|
2016-07-12 20:21:59 +09:00
|
|
|
// Wraps native Session class.
|
|
|
|
_setWrapSession(function (session) {
|
2016-06-01 10:42:24 +09:00
|
|
|
// Session is an EventEmitter.
|
|
|
|
Object.setPrototypeOf(session, EventEmitter.prototype)
|
2016-07-12 20:06:08 +09:00
|
|
|
app.emit('session-created', session)
|
2016-07-12 20:21:59 +09:00
|
|
|
})
|