@@ -64,18 +64,26 @@ export const sendExplorerRequest = (operation: string): void => {
6464export const receiveExplorerRequests = (
6565 callback : ( event : CustomEvent < MessageObj < string > > ) => void
6666) : ( ( ) => void ) => {
67- window . addEventListener ( EXPLORER_REQUEST , callback ) ;
67+ function handleEvent ( event : Event ) {
68+ callback ( event as CustomEvent < MessageObj < string > > ) ;
69+ }
70+
71+ window . addEventListener ( EXPLORER_REQUEST , handleEvent ) ;
6872 return ( ) => {
69- window . removeEventListener ( EXPLORER_REQUEST , callback ) ;
73+ window . removeEventListener ( EXPLORER_REQUEST , handleEvent ) ;
7074 } ;
7175} ;
7276
7377export const receiveSubscriptionTerminationRequest = (
7478 callback : ( event : CustomEvent < MessageObj < undefined > > ) => void
7579) : ( ( ) => void ) => {
76- window . addEventListener ( EXPLORER_SUBSCRIPTION_TERMINATION , callback ) ;
80+ function handleEvent ( event : Event ) {
81+ callback ( event as CustomEvent < MessageObj < undefined > > ) ;
82+ }
83+
84+ window . addEventListener ( EXPLORER_SUBSCRIPTION_TERMINATION , handleEvent ) ;
7785 return ( ) => {
78- window . removeEventListener ( EXPLORER_SUBSCRIPTION_TERMINATION , callback ) ;
86+ window . removeEventListener ( EXPLORER_SUBSCRIPTION_TERMINATION , handleEvent ) ;
7987 } ;
8088} ;
8189
@@ -95,7 +103,8 @@ export const sendResponseToExplorer = ({
95103} ;
96104
97105export const receiveExplorerResponses = ( ) : ( ( ) => void ) => {
98- const handleResponse = ( { detail } : CustomEvent < MessageObj > ) => {
106+ const handleResponse = ( event : Event ) => {
107+ const { detail } = event as CustomEvent < MessageObj > ;
99108 explorer . broadcast ( detail ) ;
100109 } ;
101110
0 commit comments