Skip to content
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

Some Ambiguity on WebView2 HostObjectAsyncProxyBase Documentation #2751

Open
gilmorem560 opened this issue Aug 3, 2023 · 4 comments
Open
Labels
ADO cat: webview2 WebView-related content.

Comments

@gilmorem560
Copy link

gilmorem560 commented Aug 3, 2023

Hello, I've been reviewing the WebView2 JavaScript interface documentation as I prepare a set of TypeScript interfaces for a project I'm working on and I noticed a few problems with the HostObjectAsyncProxyBase page:

  • getLocalProperty has a return type of "any" in the code quote but the Returns section, despite also listing any, then describes "A promise representing the value of the property."
  • setLocalProperty suffers from the same, listing an "any" type in the code quote and at the top of Returns, but then describes the return as a Promise.
  • Also on setLocalProperty, the "propertyName" argument is described as "Name of the property to get the value of." rather than "Name of the property of which to set the value."

The last one is minor but the first two have me wondering whether I should stick "any" or "Promise" on my interfaces.

I'm going through and modelling the whole JavaScript interface so if I find any other similar problems I'll add them to this ticket.


Document Details

Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.

AB#45821088

@gilmorem560
Copy link
Author

Alright a couple more:

  • The above issue with setLocalProperty "propertyName" description describing a get also applies to the page for HostObjectSyncProxy
  • Additionally, on both HostObjectAsyncProxyBase and HostObjectSyncProxy, the argument propertyValue for setHostProperty is described as "Value to set the property." whereas the corresponding argument to setLocalProperty is described as "Value to set the property to."

So just typographical errors, the only one leading to an actual conflict is the question of whether the asynchronous proxy methods which operate on the local object are also async or not (given they're local objects, one would assume not, but the Returns section does mention "promise" so I want to be sure.)

@captainbrosset captainbrosset added the cat: webview2 WebView-related content. label Aug 3, 2023
@captainbrosset
Copy link
Contributor

Oh, that's interesting. Thank you for filing. I agree that these descriptions are confusing. Let me make sure that this issue is tracked on our backlog, and we'll get to it as soon as possible.

@david-risney
Copy link
Contributor

Thanks for reporting these issues! Seems like we have several "copy/paste" style errors =)

getLocalProperty has a return type of "any" in the code quote but the Returns section, despite also listing any, then describes "A promise representing the value of the property."

Yes like you say, that is not a Promise. It should be any.

setLocalProperty suffers from the same, listing an "any" type in the code quote and at the top of Returns, but then describes the return as a Promise.

Yes same issue. It should be any not Promise.

Also on setLocalProperty, the "propertyName" argument is described as "Name of the property to get the value of." rather than "Name of the property of which to set the value."

Good point - will fix thanks

The above issue with setLocalProperty "propertyName" description describing a get also applies to the page for HostObjectSyncProxy

We'll fix this as well.

Additionally, on both HostObjectAsyncProxyBase and HostObjectSyncProxy, the argument propertyValue for setHostProperty is described as "Value to set the property." whereas the corresponding argument to setLocalProperty is described as "Value to set the property to."

Yes we'll fix that thanks.

@gilmorem560
Copy link
Author

Much appreciated! Hope I'm not being to nitpicky by the way, the types thing makes sense in context, but I could also see someone trying to wrap those in promises anyway just to be consistent. The joys of architecting an interface am I right?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ADO cat: webview2 WebView-related content.
Projects
None yet
Development

No branches or pull requests

3 participants