зеркало из https://github.com/electron/electron.git
Redirect guest page's ipc message to embedder
This commit is contained in:
Родитель
4fc14959a8
Коммит
95793e410d
|
@ -66,6 +66,10 @@ createGuest = (embedder, params) ->
|
|||
guest.on event, (_, args...) ->
|
||||
embedder.send "ATOM_SHELL_GUEST_VIEW_INTERNAL_DISPATCH_EVENT-#{guest.viewInstanceId}", event, args...
|
||||
|
||||
# Dispatch guest's asynchronous IPC messages to embedder.
|
||||
guest.on 'ipc-message', (_, channel, args...) ->
|
||||
embedder.send "ATOM_SHELL_GUEST_VIEW_INTERNAL_IPC_MESSAGE-#{guest.viewInstanceId}", channel, args...
|
||||
|
||||
# Autosize.
|
||||
guest.on 'size-changed', (_, args...) ->
|
||||
embedder.send "ATOM_SHELL_GUEST_VIEW_INTERNAL_SIZE_CHANGED-#{guest.viewInstanceId}", args...
|
||||
|
|
|
@ -28,6 +28,12 @@ module.exports =
|
|||
ipc.on "ATOM_SHELL_GUEST_VIEW_INTERNAL_DISPATCH_EVENT-#{viewInstanceId}", (event, args...) ->
|
||||
dispatchEvent webView, event, args...
|
||||
|
||||
ipc.on "ATOM_SHELL_GUEST_VIEW_INTERNAL_IPC_MESSAGE-#{viewInstanceId}", (channel, args...) ->
|
||||
domEvent = new Event('ipc-message')
|
||||
domEvent.channel = channel
|
||||
domEvent.args = [args...]
|
||||
webView.dispatchEvent domEvent
|
||||
|
||||
ipc.on "ATOM_SHELL_GUEST_VIEW_INTERNAL_SIZE_CHANGED-#{viewInstanceId}", (args...) ->
|
||||
domEvent = new Event('size-changed')
|
||||
for f, i in ['oldWidth', 'oldHeight', 'newWidth', 'newHeight']
|
||||
|
|
Загрузка…
Ссылка в новой задаче