[net10.0] [HybridWebView] Refactor and convert the HybridWebView.js file into a TypeScript file#29790
Merged
mattleibow merged 1 commit intonet10.0from Jun 3, 2025
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR refactors the HybridWebView implementation by converting the JavaScript file into a TypeScript file and backporting the changes to net10.0.
- Converted HybridWebView.js to HybridWebView.ts with strong typing and modern async functions.
- Updated the build configuration (csproj and Directory.Build.targets) to support TypeScript and embed the generated JavaScript.
- Removed the legacy HybridWebView.js assets in test and sample projects, updating asset references accordingly.
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/Core/src/Handlers/HybridWebView/HybridWebView.ts | New TypeScript implementation with message dispatch and .NET invocation methods. |
| src/Core/src/Handlers/HybridWebView/HybridWebView.js | Generated file updated based on the new TypeScript source. |
| src/Core/src/Core.csproj | Added TypeScript compilation settings and updated Resource embedding for HybridWebView.js. |
| src/Controls/tests/DeviceTests/Resources/Raw/HybridWebView.js | Removal of legacy implementation to prevent duplication. |
| src/Controls/tests/DeviceTests/Controls.DeviceTests.csproj | Updated asset reference for HybridWebView.js. |
| src/Controls/samples/Controls.Sample/Resources/Raw/HybridSamplePage/scripts/HybridWebView.js | Removal of obsolete JavaScript file. |
| src/Controls/samples/Controls.Sample/Maui.Controls.Sample.csproj | Revised asset inclusion pointing to the new HybridWebView.js file. |
| Directory.Build.targets | Added a target override to prevent deletion of TypeScript output files between configurations. |
|
|
||
| const requestUrl = `${window.location.origin}/__hwvInvokeDotNet?data=${encodeURIComponent(message)}`; | ||
|
|
||
| const rawResponse = await fetch(requestUrl, { |
There was a problem hiding this comment.
Consider checking rawResponse.ok before processing the response JSON to handle non-2xx HTTP responses gracefully. For example, if (!rawResponse.ok) { /* handle error */ }.
Member
Author
|
/backport to release/10.0.1xx-preview5 |
Contributor
|
Started backporting to release/10.0.1xx-preview5: https://github.com/dotnet/maui/actions/runs/15420527971 |
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
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Backport of #27183 to net10.0