Add session module
This commit is contained in:
parent
b9ddb0c268
commit
47d7d49d19
5 changed files with 22 additions and 7 deletions
17
atom/browser/api/lib/session.coffee
Normal file
17
atom/browser/api/lib/session.coffee
Normal file
|
@ -0,0 +1,17 @@
|
|||
{EventEmitter} = require 'events'
|
||||
|
||||
bindings = process.atomBinding 'session'
|
||||
|
||||
PERSIST_PERFIX = 'persist:'
|
||||
|
||||
exports.fromPartition = (partition='') ->
|
||||
if partition.startsWith PERSIST_PERFIX
|
||||
bindings.fromPartition partition.substr(PERSIST_PERFIX.length), false
|
||||
else
|
||||
bindings.fromPartition partition, true
|
||||
|
||||
wrapSession = (session) ->
|
||||
# session is an EventEmitter.
|
||||
session.__proto__ = EventEmitter.prototype
|
||||
|
||||
bindings._setWrapSession wrapSession
|
Loading…
Add table
Add a link
Reference in a new issue