-
Notifications
You must be signed in to change notification settings - Fork 528
Diagram relation of WebView2 control, SDK, & Runtime #2450
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
mikehoffms
wants to merge
71
commits into
MicrosoftDocs:main
Choose a base branch
from
mikehoffms:user/mikehoffms/wv2-intro-diagram
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 63 commits
Commits
Show all changes
71 commits
Select commit
Hold shift + click to select a range
e98ad5d
Initial draft
mikehoffms b9c34a2
linkfix
mikehoffms a6fddf4
Add tables
mikehoffms 5c871a6
Topical TOC buckets
mikehoffms ddf7797
Merge remote-tracking branch 'upstream/main' into user/mikehoffms/wv2…
mikehoffms bcfa65d
Merge remote-tracking branch 'upstream/main' into user/mikehoffms/wv2…
mikehoffms 176e5b3
Draft diagrams
mikehoffms 21528ff
AddHostObject color
mikehoffms edcf400
native-side/web-side code
mikehoffms d76e62c
Reorg sections
mikehoffms 84617df
Move diagram down, detail upper right
mikehoffms 93be2bf
linkfix
mikehoffms 1e4ecca
linkfix2
mikehoffms 47f2572
Applied h2/h4/h6 pattern in wv2 docs
mikehoffms 37ed9d2
Change tabs to h5 in wv2 docs
mikehoffms f50c324
Merge remote-tracking branch 'upstream/main' into user/mikehoffms/wv2…
mikehoffms 34b333d
Merge remote-tracking branch 'upstream/main' into user/mikehoffms/wv2…
mikehoffms 5f948a2
color diagrams
mikehoffms 46671d5
simplify
mikehoffms d35342b
labeled diagrams
mikehoffms 7d42bf4
control-runtime-sdk.png
mikehoffms 08eb77a
Merge remote-tracking branch 'upstream/main' into user/mikehoffms/wv2…
mikehoffms 7ae9651
Text of full diagram
mikehoffms fff9e8b
Merge remote-tracking branch 'upstream/main' into user/mikehoffms/wv2…
mikehoffms ed6925b
separate article for diagrams
mikehoffms 8c9ff2f
Merge remote-tracking branch 'upstream/main' into user/mikehoffms/wv2…
mikehoffms 053208d
Moved content to arch page
mikehoffms a0f3751
linkfix
mikehoffms db0addb
linkfix2
mikehoffms 4e75447
Apply suggestions from code review
Reezaali 575c785
retitle to Components
mikehoffms 0769e25
Talk through diagram
mikehoffms f986ae8
Merge remote-tracking branch 'upstream/main' into user/mikehoffms/wv2…
mikehoffms eb64192
blocking extensions
mikehoffms 7016915
Revert "blocking extensions"
mikehoffms 4792113
Merge remote-tracking branch 'upstream/main' into user/mikehoffms/wv2…
mikehoffms deab4fb
Merge remote-tracking branch 'upstream/main' into user/mikehoffms/wv2…
mikehoffms c7121d5
Merge remote-tracking branch 'upstream/main' into user/mikehoffms/wv2…
mikehoffms 4c28508
Merge remote-tracking branch 'upstream/main' into user/mikehoffms/wv2…
mikehoffms ae16e41
Merge remote-tracking branch 'upstream/main' into user/mikehoffms/wv2…
mikehoffms 0ad4f52
Merge branch 'MicrosoftDocs:main' into user/mikehoffms/wv2-intro-diagram
mikehoffms a46b9b0
Merge remote-tracking branch 'upstream/main' into user/mikehoffms/wv2…
mikehoffms a21f9d0
Merge remote-tracking branch 'upstream/main' into user/mikehoffms/wv2…
mikehoffms d79f7a7
Merge remote-tracking branch 'upstream/main' into user/mikehoffms/wv2…
mikehoffms 6c7d940
Merge remote-tracking branch 'upstream/main' into user/mikehoffms/wv2…
mikehoffms 3912862
Merge remote-tracking branch 'upstream/main' into user/mikehoffms/wv2…
mikehoffms 6d2ec16
Revert toc
mikehoffms c6d2ed4
Merge branch 'main' into pr/2450
mikehoffms 6130440
Merge branch 'main' into pr/2450
mikehoffms 1ad986a
Merge branch 'main' into pr/2450
mikehoffms e0c5418
Merge branch 'main' into pr/2450
mikehoffms 924ec27
Merge branch 'main' into pr/2450
mikehoffms ea8293e
Merge branch 'main' into pr/2450
mikehoffms 1e945f4
Merge branch 'main' into pr/2450
mikehoffms 8777ed7
Merge branch 'main' into pr/2450
mikehoffms 7e58c2b
Merge branch 'main' into pr/2450
mikehoffms 61d7af2
Merge branch 'main' into pr/2450
mikehoffms ab15a0d
Merge branch 'main' into pr/2450
mikehoffms c895971
linkfix
mikehoffms 4e77133
Merge branch 'main' into pr/2450
mikehoffms d986e6f
Merge branch 'main' into pr/2450
mikehoffms ad7ac45
Merge branch 'main' into pr/2450
mikehoffms 1bd040b
yaml
mikehoffms a2980b5
normize Download section link
mikehoffms fea1b13
Merge branch 'main' into pr/2450
mikehoffms e83c4c1
Merge branch 'main' into pr/2450
mikehoffms 7425f0d
Merge branch 'main' into pr/2450
mikehoffms dae5d12
Merge branch 'main' into pr/2450
mikehoffms 4cdbba7
Merge branch 'main' into pr/2450
mikehoffms 6ae4ff8
Merge branch 'main' into pr/2450
mikehoffms 56a29e0
Merge branch 'main' into pr/2450
mikehoffms File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+24.8 KB
microsoft-edge/webview2/concepts/intro-diagrams-images/app-design.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+30.8 KB
microsoft-edge/webview2/concepts/intro-diagrams-images/control-runtime-sdk.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+22.8 KB
microsoft-edge/webview2/concepts/intro-diagrams-images/control-sdk-runtime.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+21.7 KB
microsoft-edge/webview2/concepts/intro-diagrams-images/dev-side-user-side.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+12 KB
microsoft-edge/webview2/concepts/intro-diagrams-images/distribute-runtime.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+38.7 KB
microsoft-edge/webview2/concepts/intro-diagrams-images/full-diagram.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+11.5 KB
...oft-edge/webview2/concepts/intro-diagrams-images/hostapp-wv2ctrl-httpserver.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+15.3 KB
microsoft-edge/webview2/concepts/intro-diagrams-images/web-native.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+70.8 KB
microsoft-edge/webview2/concepts/intro-diagrams-images/what-webview.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+23.9 KB
microsoft-edge/webview2/concepts/platform-components-images/app-design.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+30.8 KB
...osoft-edge/webview2/concepts/platform-components-images/control-runtime-sdk.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+22.8 KB
...osoft-edge/webview2/concepts/platform-components-images/control-sdk-runtime.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+21.7 KB
microsoft-edge/webview2/concepts/platform-components-images/dev-side-user-side.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+12 KB
microsoft-edge/webview2/concepts/platform-components-images/distribute-runtime.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+11.5 KB
...dge/webview2/concepts/platform-components-images/hostapp-wv2ctrl-httpserver.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+10.6 KB
microsoft-edge/webview2/concepts/platform-components-images/resources.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
322 changes: 322 additions & 0 deletions
322
microsoft-edge/webview2/concepts/platform-components.md
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,7 +23,7 @@ This article assumes that you already have a working project. If you don't have | |
<!-- ====================================================================== --> | ||
## Basic WebView2 functions | ||
|
||
Use the following functions to begin embedding JavaScript in your WebView2 app. | ||
Use the following functions to embed JavaScript in the native-side code of your WebView2 app: | ||
|
||
| API | Description | | ||
| --- | --- | | ||
|
@@ -34,27 +34,27 @@ Use the following functions to begin embedding JavaScript in your WebView2 app. | |
<!-- ====================================================================== --> | ||
## Scenario: ExecuteScript JSON-encoded results | ||
|
||
Because the result of `ExecuteScriptAsync` is JSON-encoded, if the result of evaluating the JavaScript is a string, you will receive a JSON-encoded string and not the value of the string. | ||
Because the result of `ExecuteScriptAsync` is JSON-encoded, if the result of evaluating the JavaScript is a string, your native-side code will receive a JSON-encoded string, not the value of the string. | ||
|
||
For example, the following code executes script that results in a string. The resulting string includes a quote at the start, a quote at the end, and escaping slashes: | ||
For example, the following native-side code executes script that results in a string. The resulting string includes a quote at the start, a quote at the end, and escaping slashes: | ||
|
||
```csharp | ||
string result = await coreWebView2.ExecuteScriptAsync(@"'example'"); | ||
Debug.Assert(result == "\"example\""); | ||
``` | ||
|
||
The script returns a string that `ExecuteScript` JSON-encodes for you. If you call `JSON.stringify` from your script, then the result is doubly encoded as a JSON string the value of which is a JSON string. | ||
The script returns a string that `ExecuteScript` JSON-encodes for you. If you call `JSON.stringify` from your script (in your web-side code), then the result is doubly encoded, as a JSON string the value of which is a JSON string. | ||
|
||
Only the properties that are directly in the result are included in the JSON-encoded object; inherited properties aren't included in the JSON-encoded object. Most DOM objects inherit all properties, so you'll need to explicitly copy their values into another object to return. For example: | ||
Only the properties that are directly in the result are included in the JSON-encoded object; inherited properties aren't included in the JSON-encoded object. Most DOM objects inherit all properties, so your web-side code must explicitly copy the properties' values into another object and return that object to your native-side code. For example: | ||
|
||
Script | Result | ||
--- | --- | ||
`performance.memory` | `{}` | ||
`(() => { const {totalJSHeapSize, usedJSHeapSize} = performance.memory; return {totalJSHeapSize, usedJSHeapSize}; })();` | `{"totalJSHeapSize":4434368,"usedJSHeapSize":2832912}` | ||
|
||
When we return just `performance.memory` we don't see any of its properties in the result because all properties are inherited. If instead, we copy particular property values from `performance.memory` into our own new object to return, then we see those properties in the result. | ||
When we return just `performance.memory`, we don't see any of its properties in the result, because all properties are inherited. If instead, the web-side code copies particular property values from `performance.memory` into a new object and returns that object, then the native-side code sees those properties in the result. | ||
|
||
When executing script via `ExecuteScriptAsync` that script is run in the global context. It helps to have your script in an anonymous function so that any variables you define aren't polluting the global context. | ||
When executing script via `ExecuteScriptAsync`, that script is run in the global context. It helps to have your script in an anonymous function, so that any variables you define aren't polluting the global context. | ||
|
||
For example: | ||
|
||
|
@@ -67,11 +67,14 @@ For example: | |
## Scenario: Running a dedicated script file | ||
|
||
In this section, you access a dedicated JavaScript file from your WebView2 control. | ||
<!-- todo: clarify the scenario. from native code? "from" is ambiguous. is the file a web-side file? | ||
what does "dedicated" mean? --> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what does "dedicated" mean? |
||
|
||
|
||
> [!NOTE] | ||
> Although writing JavaScript inline may be efficient for quick JavaScript commands, you lose JavaScript color themes and line formatting that makes it difficult to write large sections of code in Visual Studio. | ||
|
||
To solve the problem, create a separate JavaScript file with your code, and then pass a reference to that file using the `ExecuteScriptAsync` parameters. | ||
To solve the problem, create a separate JavaScript file that contains your code, and then pass a reference to that file by using the `ExecuteScriptAsync` parameters. | ||
|
||
1. Create a `.js` file in your project, and add the JavaScript code that you want to run. For example, create a file called `script.js`. | ||
|
||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clarify the scenario. from native code? "from" is ambiguous. is the file a web-side file?