Skip to content

Commit eb708d1

Browse files
chore: bump @socket.io/component-emitter to version 3.0.0
The typed events have been moved from [1] to [2], in order to remove the intermediary class and reduce the bundle size. Diff: socketio/emitter@2.0.0...3.0.0 [1]: https://github.com/socketio/socket.io-client/ [2]: https://github.com/socketio/emitter/
1 parent 5ad3e5c commit eb708d1

File tree

3 files changed

+13
-9
lines changed

3 files changed

+13
-9
lines changed

Diff for: lib/index.ts

+9-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import Emitter from "@socket.io/component-emitter";
1+
import { Emitter } from "@socket.io/component-emitter";
22
import { deconstructPacket, reconstructPacket } from "./binary.js";
33
import { isBinary, hasBinary } from "./is-binary.js";
44
import debugModule from "debug"; // debug()
@@ -109,12 +109,16 @@ export class Encoder {
109109
}
110110
}
111111

112+
interface DecoderReservedEvents {
113+
decoded: (packet: Packet) => void;
114+
}
115+
112116
/**
113117
* A socket.io Decoder instance
114118
*
115119
* @return {Object} decoder
116120
*/
117-
export class Decoder extends Emitter {
121+
export class Decoder extends Emitter<{}, {}, DecoderReservedEvents> {
118122
private reconstructor: BinaryReconstructor;
119123

120124
constructor() {
@@ -140,11 +144,11 @@ export class Decoder extends Emitter {
140144

141145
// no attachments, labeled binary but no binary data to follow
142146
if (packet.attachments === 0) {
143-
super.emit("decoded", packet);
147+
super.emitReserved("decoded", packet);
144148
}
145149
} else {
146150
// non-binary full packet
147-
super.emit("decoded", packet);
151+
super.emitReserved("decoded", packet);
148152
}
149153
} else if (isBinary(obj) || obj.base64) {
150154
// raw binary data
@@ -155,7 +159,7 @@ export class Decoder extends Emitter {
155159
if (packet) {
156160
// received final buffer
157161
this.reconstructor = null;
158-
super.emit("decoded", packet);
162+
super.emitReserved("decoded", packet);
159163
}
160164
}
161165
} else {

Diff for: package-lock.json

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"require": "./build/cjs/index.js"
2121
},
2222
"dependencies": {
23-
"@socket.io/component-emitter": "~2.0.0",
23+
"@socket.io/component-emitter": "~3.0.0",
2424
"debug": "~4.3.1"
2525
},
2626
"devDependencies": {

0 commit comments

Comments
 (0)