unoplatform / uno

Open-source platform for building cross-platform native Mobile, Web, Desktop and Embedded apps quickly. Create rich, C#/XAML, single-codebase apps from any IDE. Hot Reload included! 90m+ NuGet Downloads!!
https://platform.uno
Apache License 2.0
9.08k stars 736 forks source link

[WebView] Add support for `ScriptNotify` #3337

Open jeromelaban opened 4 years ago

jeromelaban commented 4 years ago

What would you like to be added:

Support WebView.ScriptNotify

Why is this needed:

For which Platform:

Anything else we need to know?

ToddGlodek commented 4 years ago

Does this documentation as of 21SEP2020 indicate that this feature was add/works. (https://platform.uno/docs/articles/implemented/windows-ui-xaml-controls-webview.html) ?? Am I reading it wrong that it is WASM supported.

I installed nuGet package v (3.1.0-dev.416 of Wednesday, September 23, 2020 (9/23/2020) ); and it works in fine in UPW, but I cant get it to do anything in WASM. It doesn't even seen to give any indication that it loaded in the layout.

please advise

WebView : FrameworkElement (UWP) Control (Android/iOS/WASM/MacOS)
jeromelaban commented 4 years ago

@ToddGlodek the WebView control is not yet implemented for WebAssembly (#329) and the documentation needs to be adjusted for WebAssembly. Yet in general doing interop with javascript is generally what's needed: https://platform.uno/docs/articles/interop/wasm-javascript-1.html.

If you have a specific scenario in mind that does not work with Uno, let us know with an additional issue.

Embedding Existing JavaScript Components Into Uno-WASM - Part 1
MartinZikmund commented 1 year ago

This can be implemented in a similar manner as bi-directional communication in WebView2 (even reusing most of the logic)

ToddGlodek commented 1 year ago

Thanks - I'll try it out immediately...!!

MartinZikmund commented 1 year ago

Thanks - I'll try it out immediately...!!

@ToddGlodek just to avoid confusion - I meant the ScriptNotify method in Uno can be later implemented this way, but if you want to do something like this in current stable Uno Platform version, then swap the WebView for WebView2 and follow the docs on the two-way communication