-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinterface.ts
More file actions
47 lines (36 loc) Β· 1.62 KB
/
interface.ts
File metadata and controls
47 lines (36 loc) Β· 1.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/**
* @module IPatternEmitter
*/
import {EventEmitter} from 'events';
import {PatternEmitter} from './patternEmitter';
import {
EventEmitterType,
EventPattern,
PatternListener,
PatternEmitterInterfaceFunction,
} from './types';
export interface IPatternEmitter {
// Returns ALL listeners (both string/symbol events and RegExp patterns) as a Map
// This is a PatternEmitter-specific extension beyond standard EventEmitter
readonly allListeners: Map<EventPattern, PatternListener[]>;
addListener: PatternEmitterInterfaceFunction;
removeListener: PatternEmitterInterfaceFunction;
on: PatternEmitterInterfaceFunction;
once: PatternEmitterInterfaceFunction;
off: PatternEmitterInterfaceFunction;
// @todo prependListener: PatternEmitterInterfaceFunction;
// @todo prependOnceListener: PatternEmitterInterfaceFunction;
removeAllListeners(type?: EventPattern): PatternEmitter | EventEmitter;
listenerCount(type: EventPattern): number;
setMaxListeners(n: number): PatternEmitter | EventEmitter;
getMaxListeners(): number;
// Enhanced EventEmitter-compatible method: returns listeners for a specific event or pattern
// Accepts both string/symbol events AND RegExp patterns (PatternEmitter extension)
listeners(event: EventPattern): PatternListener[];
// Alias for listeners() with string/symbol events only - kept for backward compatibility
listenersByEventType(event: EventEmitterType): PatternListener[];
// @todo rawListeners(event: EventEmitterType): Function[];
emit(event: EventEmitterType, ...args: any[]): boolean;
eventNames(): Array<EventEmitterType>;
eventPatterns(): Array<EventPattern>;
}