CommunityToolkit / Microsoft.Toolkit.Win32

ARCHIVE - This repository contained XAML Islands wrapper controls and tooling for XAML Islands with WinUI 2, see readme for more info about XAML Islands with WinUI 3 and the WindowsAppSDK.
https://aka.ms/windowsappsdk
Other
383 stars 89 forks source link

WebViewCompatible doesn't implement InvokeScriptAsync nor NotifyScript as documentation claims, current implementation appears useless #58

Open JohnGalt1717 opened 5 years ago

JohnGalt1717 commented 5 years ago

I'm submitting a...

Bug report (I searched for similar issues and did not find one)

Current behavior

The current WebViewCompatible has a InvokeScript function but it doesn't allow passing parameters which makes it useless.

And there is no event at all for NotifyScript.

Expected behavior

Per the documentation there should be an InvokeScriptAsync(name, args) method that you can call which allows passing of args

And there should be NotifyScript event that allows you to handle notifications from scripts.

The documentation makes reference to these but I don't see them in code.

And the current InvokeScript is useless as currently implemented because you can't pass parameters.

Minimal reproduction of the problem with instructions

Nothing really to generate a simple case. Just add the Wpf version to a window and try and find both of those methods with the signatures.

Environment

WPF

Nuget Package(s):

Microsoft.ToolKit.Wpf.Ui.Controls.WebView

Package Version(s): 5.0.1

Windows 10 Build Number:

App min and target version:

Device form factor:

Visual Studio

Both of these need to be updated in the WebViewCompatible to reflect the documentation and expose the method and event.

JohnGalt1717 commented 5 years ago

I should note that it appears completely possible to implement both of these with InvokeScript being essentially trivial and ScriptNotify being a little more difficult but completely doable.