mirror of
https://github.com/socketio/socket.io.git
synced 2026-04-30 03:00:39 -04:00
See also: 00d7e7d7ee
Related:
- https://github.com/socketio/socket.io-client/issues/1188
- https://github.com/socketio/socket.io-client/issues/1378
14 lines
317 B
TypeScript
14 lines
317 B
TypeScript
import type * as Emitter from "component-emitter";
|
|
import { StrictEventEmitter } from "./typed-events.js";
|
|
|
|
export function on(
|
|
obj: Emitter | StrictEventEmitter<any, any>,
|
|
ev: string,
|
|
fn: (err?: any) => any
|
|
): VoidFunction {
|
|
obj.on(ev, fn);
|
|
return function subDestroy(): void {
|
|
obj.off(ev, fn);
|
|
};
|
|
}
|