-
Notifications
You must be signed in to change notification settings - Fork 552
Expand file tree
/
Copy pathhostobjectasyncproxybase.yml
More file actions
137 lines (134 loc) · 6.68 KB
/
hostobjectasyncproxybase.yml
File metadata and controls
137 lines (134 loc) · 6.68 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
### YamlMime:TSType
name: HostObjectAsyncProxyBase
uid: 'WebView2Script!HostObjectAsyncProxyBase:class'
package: WebView2Script!
fullName: HostObjectAsyncProxyBase
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: applyHostFunction(argArray)
uid: 'WebView2Script!HostObjectAsyncProxyBase#applyHostFunction:member(1)'
package: WebView2Script!
fullName: applyHostFunction(argArray)
summary: |-
Perform a method invocation on the host object that corresponds to this proxy.
All parameters are converted to call the host object method.
remarks: ''
isPreview: false
isDeprecated: false
syntax:
content: 'applyHostFunction(argArray?: any): Promise<any>;'
parameters:
- id: argArray
description: An array of arguments to pass to the host object method invocation.
type: any
return:
type: Promise<any>
description: A promise representing the converted value of the return value of the host object method invocation.
- name: getHostProperty(propertyName)
uid: 'WebView2Script!HostObjectAsyncProxyBase#getHostProperty:member(1)'
package: WebView2Script!
fullName: getHostProperty(propertyName)
summary: >-
Perform a property `get` on the host object. Use this method to explicitly force a property get to occur remotely
if a conflicting local method or property exists. For instance, `proxy.toString()` runs the local `toString`
method on the proxy object. But proxy.applyHostFunction('toString') runs toString on the host proxied object
instead.
remarks: ''
isPreview: false
isDeprecated: false
syntax:
content: 'getHostProperty(propertyName: string): Promise<any>;'
parameters:
- id: propertyName
description: String name of the property of which to get the value.
type: string
return:
type: Promise<any>
description: A promise representing the converted value of the property of the host object's property.
- name: getLocalProperty(propertyName)
uid: 'WebView2Script!HostObjectAsyncProxyBase#getLocalProperty:member(1)'
package: WebView2Script!
fullName: getLocalProperty(propertyName)
summary: >-
Perform a property `get` locally on the proxy object. Use the methods to force getting a property on the host
object proxy rather than on the host object it represents. For instance, `proxy.unknownProperty` gets the property
named `unknownProperty` from the host proxied object. But `proxy.getLocalProperty('unknownProperty')` gets the
value of the property `unknownProperty` on the proxy object.
remarks: ''
isPreview: false
isDeprecated: false
syntax:
content: 'getLocalProperty(propertyName: string): any;'
parameters:
- id: propertyName
description: Name of the property to get the value of.
type: string
return:
type: any
description: The value of the property.
- name: 'setHostProperty(propertyName, propertyValue)'
uid: 'WebView2Script!HostObjectAsyncProxyBase#setHostProperty:member(1)'
package: WebView2Script!
fullName: 'setHostProperty(propertyName, propertyValue)'
summary: >-
Perform a property `set` on the host object. Use this method to explicitly force a property `set` to occur
remotely if a conflicting local method or property exists.
remarks: ''
isPreview: false
isDeprecated: false
syntax:
content: 'setHostProperty(propertyName: string, propertyValue: any): Promise<any>;'
parameters:
- id: propertyName
description: Name of the property of which to set the value.
type: string
- id: propertyValue
description: Value to set the property to.
type: any
return:
type: Promise<any>
description: >-
A promise representing the converted value of the property of the host object's property. This promise only
resolves after the property value has been changed.
- name: 'setLocalProperty(propertyName, propertyValue)'
uid: 'WebView2Script!HostObjectAsyncProxyBase#setLocalProperty:member(1)'
package: WebView2Script!
fullName: 'setLocalProperty(propertyName, propertyValue)'
summary: >-
Perform a property `set` locally on the proxy object. Use the methods to force setting a property on the host
object proxy rather than on the host object it represents. For instance, `proxy.unknownProperty = 2` sets the
property named `unknownProperty` on the host proxied object. But `proxy.setLocalProperty('unknownProperty', 2)`
sets the value of the property `unknownProperty` on the proxy object.
remarks: ''
isPreview: false
isDeprecated: false
syntax:
content: 'setLocalProperty(propertyName: string, propertyValue: any): any;'
parameters:
- id: propertyName
description: Name of the property of which to set the value.
type: string
- id: propertyValue
description: Value to set the property to.
type: any
return:
type: any
description: >-
The value of the property after it is set.
extends: <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a>