mirror of
https://github.com/socketio/socket.io.git
synced 2026-01-13 08:57:59 -05:00
The typed events have been moved to [1] in order to remove the intermediary class and reduce the bundle size. Diff: https://github.com/socketio/emitter/compare/2.0.0...3.0.0 [1]: https://github.com/socketio/emitter/
13 lines
245 B
TypeScript
13 lines
245 B
TypeScript
import { Emitter } from "@socket.io/component-emitter";
|
|
|
|
export function on(
|
|
obj: Emitter<any, any>,
|
|
ev: string,
|
|
fn: (err?: any) => any
|
|
): VoidFunction {
|
|
obj.on(ev, fn);
|
|
return function subDestroy(): void {
|
|
obj.off(ev, fn);
|
|
};
|
|
}
|