edge-developer
edge-developer copied to clipboard
Some Ambiguity on WebView2 HostObjectAsyncProxyBase Documentation
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
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.
- ID: 562eb497-63a1-c654-3158-fcfddae44cd6
- Version Independent ID: 562eb497-63a1-c654-3158-fcfddae44cd6
- Content: HostObjectAsyncProxyBase class - Microsoft Edge Development
- Content Source: microsoft-edge/webview2/reference/javascript/hostobjectasyncproxybase.yml
- GitHub Login: @peiche-jessica
AB#45821088
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.)
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.
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.
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?
PR 3243 is live (Fix typos in JS AddHostObjectAsyncProxyBase & AddHostObjectSyncProxy). https://learn.microsoft.com/microsoft-edge/webview2/reference/javascript/hostobjectasyncproxybase https://learn.microsoft.com/microsoft-edge/webview2/reference/javascript/hostobjectsyncproxy