@signalwire/core
Version:
Shared code for the SignalWire JS SDK
20 lines (19 loc) • 577 B
text/typescript
/**
* Class representing a close event.
* The `ws` package does not expose it so we can easily create one in here.
*
* @extends Event
*/
export class SWCloseEvent {
public code: number
public reason: string
public wasClean: boolean
constructor(
public type: string,
options: { code?: number; reason?: string; wasClean?: boolean } = {}
) {
this.code = options.code === undefined ? 0 : options.code
this.reason = options.reason === undefined ? '' : options.reason
this.wasClean = options.wasClean === undefined ? false : options.wasClean
}
}