blob: 08b46a5c36519f1d383449415745f3f401941aed (
plain) (
blame)
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
|
import { MChannel, MVideo } from '@server/types/models'
import { EventEmitter } from 'events'
export interface PeerTubeInternalEvents {
'video-created': (options: { video: MVideo }) => void
'video-updated': (options: { video: MVideo }) => void
'video-deleted': (options: { video: MVideo }) => void
'channel-created': (options: { channel: MChannel }) => void
'channel-updated': (options: { channel: MChannel }) => void
'channel-deleted': (options: { channel: MChannel }) => void
}
declare interface InternalEventEmitter {
on<U extends keyof PeerTubeInternalEvents>(
event: U, listener: PeerTubeInternalEvents[U]
): this
emit<U extends keyof PeerTubeInternalEvents>(
event: U, ...args: Parameters<PeerTubeInternalEvents[U]>
): boolean
}
class InternalEventEmitter extends EventEmitter {
private static instance: InternalEventEmitter
static get Instance () {
return this.instance || (this.instance = new this())
}
}
export {
InternalEventEmitter
}
|