-
Notifications
You must be signed in to change notification settings - Fork 552
Expand file tree
/
Copy pathhostobjectasyncproxy.yml
More file actions
43 lines (41 loc) · 2.41 KB
/
hostobjectasyncproxy.yml
File metadata and controls
43 lines (41 loc) · 2.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
### YamlMime:TSType
name: HostObjectAsyncProxy
uid: 'WebView2Script!HostObjectAsyncProxy:class'
package: WebView2Script!
fullName: HostObjectAsyncProxy
summary: >-
An asynchronous host object proxy. Host objects added via `CoreWebView2.AddHostObjectToScript` are exposed as host
object proxies using `window.chrome.webview.hostObjects.{name}`<!-- -->. Host object proxies are promises, and resolve
to an object representing the host object. The promise is rejected if the app has not added an object with the name.
When JavaScript code access a property or method of the object, a promise is returned. The promise resolves to the
value that's returned from the host for the property or method. The promise is rejected in case of error; for example,
no property or method on the object or parameters are not valid.
Host object proxies are JavaScript Proxy objects that intercept all property `get`<!-- -->, property `set`<!-- -->,
and method invocations. Properties or methods that are a part of the `Function` or `Object` prototype are run in the
JavaScript engine of the current document. Additionally any property or method in the
`chrome.webview.hostObjects.options.forceLocalProperties` array are also run in the JavaScript engine of the current
document. This defaults to including optional methods that have meaning in JavaScript like `toJSON` and
`Symbol.toPrimitive`<!-- -->. Add more to the array as required.
remarks: ''
isPreview: false
isDeprecated: false
type: class
methods:
- name: sync()
uid: 'WebView2Script!HostObjectAsyncProxy#sync:member(1)'
package: WebView2Script!
fullName: sync()
summary: >-
A method which returns a promise for a synchronous host object proxy for the same host object. For example,
`chrome.webview.hostObjects.sample.methodCall()` returns an asynchronous host object proxy. Use the `sync` method
to obtain a synchronous host object proxy instead: `const syncProxy = await
chrome.webview.hostObjects.sample.methodCall().sync()`<!-- -->.
remarks: ''
isPreview: false
isDeprecated: false
syntax:
content: 'sync(): Promise<HostObjectSyncProxy>;'
return:
type: 'Promise<<xref uid="WebView2Script!HostObjectSyncProxy:class" />>'
description: A promise representing the synchronous host object proxy.
extends: '<xref uid="WebView2Script!HostObjectAsyncProxyBase:class" />'