Closed andsouto closed 5 years ago
When using the addEventListener/removeEventListener methods to listen for error events, the event parameter is expected to be of type ErrorEvent. See https://github.com/pladaria/reconnecting-websocket/blob/master/events.ts#L37
addEventListener
removeEventListener
ErrorEvent
export interface WebSocketEventListenerMap { close: (event: CloseEvent) => void | {handleEvent: (event: CloseEvent) => void}; error: (event: ErrorEvent) => void | {handleEvent: (event: ErrorEvent) => void}; message: (event: MessageEvent) => void | {handleEvent: (event: MessageEvent) => void}; open: (event: Event) => void | {handleEvent: (event: Event) => void}; }
However, when using the .onerror property the event is expected to be of type Event. See https://github.com/pladaria/reconnecting-websocket/blob/master/reconnecting-websocket.ts#L194
.onerror
Event
public onerror?: (event: Event) => void = undefined;
Thanks for reporting, next version will fix it
When using the
addEventListener
/removeEventListener
methods to listen for error events, the event parameter is expected to be of typeErrorEvent
. See https://github.com/pladaria/reconnecting-websocket/blob/master/events.ts#L37However, when using the
.onerror
property the event is expected to be of typeEvent
. See https://github.com/pladaria/reconnecting-websocket/blob/master/reconnecting-websocket.ts#L194