@mswjs/interceptors
Advanced tools
Comparing version
@@ -5,2 +5,21 @@ import { I as Interceptor } from '../../Interceptor-af98b768.js'; | ||
declare const kCancelable: unique symbol; | ||
declare const kDefaultPrevented: unique symbol; | ||
/** | ||
* A `MessageEvent` superset that supports event cancellation | ||
* in Node.js. It's rather non-intrusive so it can be safely | ||
* used in the browser as well. | ||
* | ||
* @see https://github.com/nodejs/node/issues/51767 | ||
*/ | ||
declare class CancelableMessageEvent<T = any> extends MessageEvent<T> { | ||
[kCancelable]: boolean; | ||
[kDefaultPrevented]: boolean; | ||
constructor(type: string, init: MessageEventInit<T>); | ||
get cancelable(): boolean; | ||
set cancelable(nextCancelable: boolean); | ||
get defaultPrevented(): boolean; | ||
set defaultPrevented(nextDefaultPrevented: boolean); | ||
preventDefault(): void; | ||
} | ||
interface CloseEventInit extends EventInit { | ||
@@ -17,2 +36,12 @@ code?: number; | ||
} | ||
declare class CancelableCloseEvent extends CloseEvent { | ||
[kCancelable]: boolean; | ||
[kDefaultPrevented]: boolean; | ||
constructor(type: string, init?: CloseEventInit); | ||
get cancelable(): boolean; | ||
set cancelable(nextCancelable: boolean); | ||
get defaultPrevented(): boolean; | ||
set defaultPrevented(nextDefaultPrevented: boolean); | ||
preventDefault(): void; | ||
} | ||
@@ -244,2 +273,2 @@ type WebSocketData = string | ArrayBufferLike | Blob | ArrayBufferView; | ||
export { WebSocketClientConnection, WebSocketClientConnectionProtocol, WebSocketClientEventMap, WebSocketConnectionData, WebSocketData, WebSocketEventMap$1 as WebSocketEventMap, WebSocketInterceptor, WebSocketServerConnection, WebSocketServerConnectionProtocol, WebSocketServerEventMap, WebSocketTransport }; | ||
export { CancelableCloseEvent, CancelableMessageEvent, CloseEvent, WebSocketClientConnection, WebSocketClientConnectionProtocol, WebSocketClientEventMap, WebSocketConnectionData, WebSocketData, WebSocketEventMap$1 as WebSocketEventMap, WebSocketInterceptor, WebSocketServerConnection, WebSocketServerConnectionProtocol, WebSocketServerEventMap, WebSocketTransport }; |
@@ -715,3 +715,6 @@ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); | ||
exports.WebSocketClientConnection = WebSocketClientConnection; exports.WebSocketClientConnectionProtocol = WebSocketClientConnectionProtocol; exports.WebSocketInterceptor = WebSocketInterceptor; exports.WebSocketServerConnection = WebSocketServerConnection; exports.WebSocketServerConnectionProtocol = WebSocketServerConnectionProtocol; | ||
exports.CancelableCloseEvent = CancelableCloseEvent; exports.CancelableMessageEvent = CancelableMessageEvent; exports.CloseEvent = CloseEvent; exports.WebSocketClientConnection = WebSocketClientConnection; exports.WebSocketClientConnectionProtocol = WebSocketClientConnectionProtocol; exports.WebSocketInterceptor = WebSocketInterceptor; exports.WebSocketServerConnection = WebSocketServerConnection; exports.WebSocketServerConnectionProtocol = WebSocketServerConnectionProtocol; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@mswjs/interceptors", | ||
"description": "Low-level HTTP/HTTPS/XHR/fetch request interception library.", | ||
"version": "0.39.1", | ||
"version": "0.39.2", | ||
"main": "./lib/node/index.js", | ||
@@ -6,0 +6,0 @@ "module": "./lib/node/index.mjs", |
@@ -31,2 +31,8 @@ import { Interceptor } from '../../Interceptor' | ||
export { | ||
CloseEvent, | ||
CancelableCloseEvent, | ||
CancelableMessageEvent, | ||
} from './utils/events' | ||
export type WebSocketEventMap = { | ||
@@ -33,0 +39,0 @@ connection: [args: WebSocketConnectionData] |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
1471905
0.11%19462
0.19%