You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Originally posted by danbahrami March 7, 2023
Hi, I'm looking through the WebView2 docs and can't find any API reference for window.chrome.webview. Specifically I'm looking to define a global TypeScript interface for window.chrome.webview.postMessage and window.chrome.webview.addEventListener.
I have a couple of questions:
1. What's the method for removing event listeners?
I can't tell if window.chrome.addEventListener returns an unsubscribe callback or if there's an adjacent removeEventListener that behaves the same as adding/removing DOM events.
2. Do you have a recommendation for a global TypeScript definition?
Here's what I've got so far but I'm not sure if it's accurate
declare global {interfaceWindow{chrome?: {webview?: {addEventListener: (message: string,handler: (event: any)=>void,// not sure yet what the event type should be)=>void;postMessage: (message: string)=>void;};};}}
The text was updated successfully, but these errors were encountered:
victorhuangwq
changed the title
[Feature RequestTypeScript definitions for window.chrome.webview
[Feature Request] TypeScript definitions for window.chrome.webview
Nov 27, 2023
Describe the feature/enhancement you need
Global TypeScript Interface for window.chrome.webview
The scenario/use case where you would use this feature
When developing using Typescript while using WebView2
Refer to the discussion for further context.
Discussed in #4028
Originally posted by danbahrami March 7, 2023
Hi, I'm looking through the WebView2 docs and can't find any API reference for
window.chrome.webview
. Specifically I'm looking to define a global TypeScript interface forwindow.chrome.webview.postMessage
andwindow.chrome.webview.addEventListener
.I have a couple of questions:
1. What's the method for removing event listeners?
I can't tell if
window.chrome.addEventListener
returns an unsubscribe callback or if there's an adjacentremoveEventListener
that behaves the same as adding/removing DOM events.2. Do you have a recommendation for a global TypeScript definition?
Here's what I've got so far but I'm not sure if it's accurate
AB#40423422
The text was updated successfully, but these errors were encountered: