api: Add webContent.create() to create detached WebContents
This commit is contained in:
parent
c72d769ff0
commit
d34cff2eef
5 changed files with 78 additions and 9 deletions
|
@ -1,4 +1,5 @@
|
|||
EventEmitter = require('events').EventEmitter
|
||||
binding = process.atomBinding 'web_contents'
|
||||
ipc = require 'ipc'
|
||||
|
||||
module.exports.wrap = (webContents) ->
|
||||
|
@ -40,3 +41,11 @@ module.exports.wrap = (webContents) ->
|
|||
ipc.emit channel, event, args...
|
||||
|
||||
webContents
|
||||
|
||||
module.exports.create = (options={}) ->
|
||||
webContents = @wrap binding.create(options)
|
||||
|
||||
# Ensure the webContents is destroyed on exit.
|
||||
process.on 'exit', -> webContents.destroy()
|
||||
|
||||
webContents
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue