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
{{ message }}
This repository was archived by the owner on Dec 17, 2024. It is now read-only.
You often need to assign a listener so that you can reference it when removing it. This leads to needing to write out the type for the argument of the listener which isn't simple to do currently.
We should look at adding a utility type here, possibly for the whole listener.
Current code for this looks something like:
useEffect(()=>{constlistener=(event: CogsStateChangedEvent<Partial<ManifestTypes.StateAsObject<typeofmanifest>>>)=>{if(event.state.State){try{// TODO: Do something with state}catch(e){console.error("Couldn't parse incoming state",e);}}};connection.addEventListener("state",listener);return()=>{connection.removeEventListener("state",listener);};},[connection]);