@@ -93,12 +93,7 @@ function reduceState(
9393 }
9494
9595 case "DISPOSE" :
96- switch ( state ) {
97- case ConnectionState . DISPOSED :
98- return state ;
99- default :
100- return ConnectionState . DISPOSED ;
101- }
96+ return ConnectionState . DISPOSED ;
10297 }
10398}
10499
@@ -172,7 +167,7 @@ export class ReconnectingWebSocket<
172167 this . #onDispose = onDispose ;
173168 }
174169
175- static async create < TData > (
170+ public static async create < TData > (
176171 socketFactory : SocketFactory < TData > ,
177172 logger : Logger ,
178173 options : ReconnectingWebSocketOptions ,
@@ -190,14 +185,14 @@ export class ReconnectingWebSocket<
190185 return instance ;
191186 }
192187
193- get url ( ) : string {
188+ public get url ( ) : string {
194189 return this . #currentSocket?. url ?? "" ;
195190 }
196191
197192 /**
198193 * Returns the current connection state.
199194 */
200- get state ( ) : ConnectionState {
195+ public get state ( ) : ConnectionState {
201196 return this . #state;
202197 }
203198
@@ -214,14 +209,14 @@ export class ReconnectingWebSocket<
214209 return url . pathname + url . search ;
215210 }
216211
217- addEventListener < TEvent extends WebSocketEventType > (
212+ public addEventListener < TEvent extends WebSocketEventType > (
218213 event : TEvent ,
219214 callback : EventHandler < TData , TEvent > ,
220215 ) : void {
221216 this . #eventHandlers[ event ] . add ( callback ) ;
222217 }
223218
224- removeEventListener < TEvent extends WebSocketEventType > (
219+ public removeEventListener < TEvent extends WebSocketEventType > (
225220 event : TEvent ,
226221 callback : EventHandler < TData , TEvent > ,
227222 ) : void {
@@ -232,7 +227,7 @@ export class ReconnectingWebSocket<
232227 * Force an immediate reconnection attempt.
233228 * Resumes the socket if previously disconnected via disconnect().
234229 */
235- reconnect ( ) : void {
230+ public reconnect ( ) : void {
236231 if ( this . #state === ConnectionState . DISPOSED ) {
237232 return ;
238233 }
@@ -254,14 +249,14 @@ export class ReconnectingWebSocket<
254249 /**
255250 * Temporarily disconnect the socket. Can be resumed via reconnect().
256251 */
257- disconnect ( code ?: number , reason ?: string ) : void {
252+ public disconnect ( code ?: number , reason ?: string ) : void {
258253 if ( ! this . #dispatch( { type : "DISCONNECT" } ) ) {
259254 return ;
260255 }
261256 this . clearCurrentSocket ( code , reason ) ;
262257 }
263258
264- close ( code ?: number , reason ?: string ) : void {
259+ public close ( code ?: number , reason ?: string ) : void {
265260 if ( this . #state === ConnectionState . DISPOSED ) {
266261 return ;
267262 }
0 commit comments