Bind WebContents APIs to <webview>
This commit is contained in:
parent
46ed83a057
commit
07a8a50861
2 changed files with 36 additions and 1 deletions
|
@ -494,6 +494,41 @@ registerWebViewElement = ->
|
||||||
internal.elementAttached = true
|
internal.elementAttached = true
|
||||||
internal.parseAttributes()
|
internal.parseAttributes()
|
||||||
|
|
||||||
|
# Public-facing API methods.
|
||||||
|
methods = [
|
||||||
|
"getUrl"
|
||||||
|
"getTitle"
|
||||||
|
"isLoading"
|
||||||
|
"isWaitingForResponse"
|
||||||
|
"stop"
|
||||||
|
"reload"
|
||||||
|
"reloadIngoringCache"
|
||||||
|
"canGoBack"
|
||||||
|
"canGoForward"
|
||||||
|
"canGoToOffset"
|
||||||
|
"goBack"
|
||||||
|
"goForward"
|
||||||
|
"goToIndex"
|
||||||
|
"goToOffset"
|
||||||
|
"isCrashed"
|
||||||
|
"executeJavaScript"
|
||||||
|
"send"
|
||||||
|
# "getUserAgent"
|
||||||
|
# "getZoom"
|
||||||
|
# "insertCSS"
|
||||||
|
# "print"
|
||||||
|
# "setUserAgentOverride"
|
||||||
|
# "setZoom"
|
||||||
|
# "terminate"
|
||||||
|
]
|
||||||
|
|
||||||
|
# Forward proto.foo* method calls to WebView.foo*.
|
||||||
|
createHandler = (m) ->
|
||||||
|
(args...) ->
|
||||||
|
internal = v8Util.getHiddenValue this, 'internal'
|
||||||
|
remote.getGuestWebContents(internal.guestInstanceId)[m] args...
|
||||||
|
proto[m] = createHandler m for m in methods
|
||||||
|
|
||||||
window.WebView = webFrame.registerEmbedderCustomElement 'webview',
|
window.WebView = webFrame.registerEmbedderCustomElement 'webview',
|
||||||
prototype: proto
|
prototype: proto
|
||||||
|
|
||||||
|
|
|
@ -602,7 +602,7 @@ Navigates to the specified absolute index.
|
||||||
|
|
||||||
Navigates to the specified offset from the "current entry".
|
Navigates to the specified offset from the "current entry".
|
||||||
|
|
||||||
### WebContents.IsCrashed()
|
### WebContents.isCrashed()
|
||||||
|
|
||||||
Whether the renderer process has crashed.
|
Whether the renderer process has crashed.
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue