socket.io-parser
4.2.44.2.6
build/esm-debug/index.d.ts~
build/esm-debug/index.d.tsModified+15−4
Index: package/build/esm-debug/index.d.ts
===================================================================
--- package/build/esm-debug/index.d.ts
+++ package/build/esm-debug/index.d.ts
@@ -52,22 +52,32 @@
}
interface DecoderReservedEvents {
decoded: (packet: Packet) => void;
}
+type JSONReviver = (this: any, key: string, value: any) => any;
+export interface DecoderOptions {
+ /**
+ * Custom reviver to pass down to JSON.parse()
+ */
+ reviver?: JSONReviver;
+ /**
+ * Maximum number of binary attachments per packet
+ * @default 10
+ */
+ maxAttachments?: number;
+}
/**
* A socket.io Decoder instance
*
* @return {Object} decoder
*/
export declare class Decoder extends Emitter<{}, {}, DecoderReservedEvents> {
- private reviver?;
private reconstructor;
+ private opts;
/**
* Decoder constructor
- *
- * @param {function} reviver - custom reviver to pass down to JSON.stringify
*/
- constructor(reviver?: (this: any, key: string, value: any) => any);
+ constructor(opts?: DecoderOptions | JSONReviver);
/**
* Decodes an encoded packet string into packet JSON.
*
* @param {String} obj - encoded packet
@@ -86,5 +96,6 @@
* Deallocates a parser's resources
*/
destroy(): void;
}
+export declare function isPacketValid(packet: Packet): boolean;
export {};