chore(): ws client tidying and misc improvements
This commit is contained in:
@@ -1,31 +1,30 @@
|
||||
/* eslint-disable @typescript-eslint/no-unused-vars */
|
||||
/* eslint-disable no-unused-vars */
|
||||
/* eslint-disable @typescript-eslint/no-empty-function */
|
||||
import { WebsocketClient, WsClientEvent } from '../src';
|
||||
import { DefaultLogger, WebsocketClient } from '../src';
|
||||
|
||||
export function getSilentLogger(_logHint?: string) {
|
||||
export function getSilentLogger(_logHint?: string): typeof DefaultLogger {
|
||||
return {
|
||||
silly: () => {},
|
||||
debug: () => {},
|
||||
notice: () => {},
|
||||
trace: () => {},
|
||||
info: () => {},
|
||||
warning: () => {},
|
||||
error: () => {},
|
||||
};
|
||||
}
|
||||
|
||||
export const fullLogger = {
|
||||
silly: (...params) => console.log('silly', ...params),
|
||||
debug: (...params) => console.log('debug', ...params),
|
||||
notice: (...params) => console.log('notice', ...params),
|
||||
export const fullLogger: typeof DefaultLogger = {
|
||||
trace: (...params) => console.log('trace', ...params),
|
||||
info: (...params) => console.info('info', ...params),
|
||||
warning: (...params) => console.warn('warning', ...params),
|
||||
error: (...params) => console.error('error', ...params),
|
||||
};
|
||||
|
||||
export const WS_OPEN_EVENT_PARTIAL = {
|
||||
type: 'open',
|
||||
};
|
||||
export type WsClientEvent =
|
||||
| 'open'
|
||||
| 'update'
|
||||
| 'close'
|
||||
| 'error'
|
||||
| 'reconnect'
|
||||
| 'reconnected'
|
||||
| 'response';
|
||||
|
||||
/** Resolves a promise if an event is seen before a timeout (defaults to 4.5 seconds) */
|
||||
export function waitForSocketEvent(
|
||||
|
||||
Reference in New Issue
Block a user