Skip to content

Commit 9e601c6

Browse files
refactor: export Packet interface and refactor imports
1 parent cfdc479 commit 9e601c6

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

lib/index.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import * as Emitter from "component-emitter";
2-
import * as binary from "./binary";
1+
import Emitter from "component-emitter";
2+
import { deconstructPacket, reconstructPacket } from "./binary";
33
import isBinary from "./is-binary";
44
import debugModule from "debug";
55

@@ -23,7 +23,7 @@ export enum PacketType {
2323
BINARY_ACK,
2424
}
2525

26-
interface Packet {
26+
export interface Packet {
2727
type: PacketType;
2828
nsp: string;
2929
data?: any;
@@ -99,7 +99,7 @@ export class Encoder {
9999
*/
100100

101101
private encodeAsBinary(obj: Packet) {
102-
const deconstruction = binary.deconstructPacket(obj);
102+
const deconstruction = deconstructPacket(obj);
103103
const pack = this.encodeAsString(deconstruction.packet);
104104
const buffers = deconstruction.buffers;
105105

@@ -285,7 +285,7 @@ class BinaryReconstructor {
285285
this.buffers.push(binData);
286286
if (this.buffers.length === this.reconPack.attachments) {
287287
// done with buffer list
288-
const packet = binary.reconstructPacket(this.reconPack, this.buffers);
288+
const packet = reconstructPacket(this.reconPack, this.buffers);
289289
this.finishedReconstruction();
290290
return packet;
291291
}

tsconfig.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
"allowJs": false,
55
"target": "es2017",
66
"module": "commonjs",
7-
"declaration": true
7+
"declaration": true,
8+
"esModuleInterop": true
89
},
910
"include": [
1011
"./lib/**/*"

0 commit comments

Comments
 (0)