electron/lib/browser/api/session.js
2016-07-13 12:23:14 +09:00

22 lines
576 B
JavaScript

const {EventEmitter} = require('events')
const {app} = require('electron')
const {fromPartition, _setWrapSession} = process.atomBinding('session')
// Returns the default session.
Object.defineProperties(exports, {
defaultSession: {
enumerable: true,
get () { return fromPartition('') }
},
fromPartition: {
enumerable: true,
value: fromPartition
}
})
// Wraps native Session class.
_setWrapSession(function (session) {
// Session is an EventEmitter.
Object.setPrototypeOf(session, EventEmitter.prototype)
app.emit('session-created', session)
})