@@ -97,6 +97,11 @@ _(This is conceptual documentation that will go to learn.microsoft.com "how to"
97
97
example code with each description in both C# (for our WinRT API or .NET API) and
98
98
in C++ for our COM API. Use snippets of the sample code you wrote for the sample apps.
99
99
The sample code for C++ and C# should demonstrate the same thing.
100
+ If you are introducing a JavaScript API or otherwise the sample relies on HTML or JS
101
+ include that and consider including it in its own HTML or JS sample code.
102
+
103
+ As an example of this section, see the Examples section for the Custom Downloads
104
+ APIs (https://github.com/MicrosoftEdge/WebView2Feedback/blob/master/specs/CustomDownload.md).
100
105
101
106
The general format is:
102
107
@@ -120,6 +125,14 @@ _(This is conceptual documentation that will go to learn.microsoft.com "how to"
120
125
}
121
126
```
122
127
128
+ If the sample code requires JS or HTML include that as well
129
+
130
+ ```html
131
+ <script>
132
+ chrome.webview.postMessage(...);
133
+ </script>
134
+ ```
135
+
123
136
## SecondFeatureName
124
137
125
138
Feature explanation text goes here, including why an app would use it, how it
@@ -140,8 +153,15 @@ _(This is conceptual documentation that will go to learn.microsoft.com "how to"
140
153
}
141
154
```
142
155
143
- As an example of this section, see the Examples section for the Custom Downloads
144
- APIs (https://github.com/MicrosoftEdge/WebView2Feedback/blob/master/specs/CustomDownload.md).
156
+
157
+ If the sample code requires JS or HTML include that as well
158
+
159
+ ```html
160
+ <script>
161
+ chrome.webview.postMessage(...);
162
+ </script>
163
+ ```
164
+
145
165
-->
146
166
147
167
# API Details
@@ -194,6 +214,33 @@ namespace Microsoft.Web.WebView2.Core
194
214
}
195
215
}
196
216
```
217
+
218
+ If you are introducing a WebView2 JavaScript API include the TypeScript
219
+ definition of that API and reference documentation for it as well.
220
+ You can use https://www.typescriptlang.org/play to verify your TypeScript
221
+
222
+ ```ts
223
+ interface WebView extends EventTarget {
224
+ postMessage(message: any) : void;
225
+ hostObjects: HostObjectsAsyncRoot;
226
+ // ...
227
+ }
228
+
229
+ interface HostObjectsAsyncRoot {
230
+ cleanupSome() : void;
231
+ options: HostObjectsOptions;
232
+ }
233
+
234
+ interface HostObjectsOptions {
235
+ forceLocalProperties: string[];
236
+ log: (...data: any[]) => void;
237
+ shouldSerializeDates: boolean;
238
+ defaultSyncProxy: boolean;
239
+ forceAsyncMethodMatches: RegExp[];
240
+ ignoreMemberNotFoundError: boolean;
241
+ }
242
+ ```
243
+
197
244
-->
198
245
199
246
0 commit comments