-
Notifications
You must be signed in to change notification settings - Fork 9
PgChannelEmitter
Globals / PgChannelEmitter
Implements event emitting/subscribing on PostgreSQL LISTEN/NOTIFY named channels.
-
EventEmitter
↳ PgChannelEmitter
- addListener
- emit
- eventNames
- getMaxListeners
- listenerCount
- listeners
- off
- on
- once
- prependListener
- prependOnceListener
- rawListeners
- removeAllListeners
- removeListener
- setMaxListeners
- listenerCount
+ new PgChannelEmitter(options?
: EventEmitterOptions): PgChannelEmitter
Inherited from PgChannelEmitter.constructor
Name | Type |
---|---|
options? |
EventEmitterOptions |
Returns: PgChannelEmitter
• channel(payload
: AnyJson): void
Channel listener event, occurs whenever the listening channel gets a new payload message.
asmemberof
PgChannelEmitter
Name | Type | Description |
---|---|---|
payload |
AnyJson | event payload |
Returns: void
▪ Static
defaultMaxListeners: number
Inherited from PgChannelEmitter.defaultMaxListeners
▪ Static
Readonly
errorMonitor: unique symbol
Inherited from PgChannelEmitter.errorMonitor
This symbol shall be used to install a listener for only monitoring 'error'
events. Listeners installed using this symbol are called before the regular
'error'
listeners are called.
Installing a listener using this symbol does not change the behavior once an
'error'
event is emitted, therefore the process will still crash if no
regular 'error'
listener is installed.
▸ addListener(event
: string | symbol, listener
: (...args: any[]) => void): this
Inherited from PgClient.addListener
Name | Type |
---|---|
event |
string | symbol |
listener |
(...args: any[]) => void |
Returns: this
▸ emit(event
: string | symbol, ...args
: any[]): boolean
Name | Type |
---|---|
event |
string | symbol |
...args |
any[] |
Returns: boolean
▸ eventNames(): Array<string | symbol>
Inherited from PgClient.eventNames
Returns: Array<string | symbol>
▸ getMaxListeners(): number
Inherited from PgClient.getMaxListeners
Returns: number
▸ listenerCount(event
: string | symbol): number
Inherited from PgClient.listenerCount
Name | Type |
---|---|
event |
string | symbol |
Returns: number
▸ listeners(event
: string | symbol): Function[]
Inherited from PgClient.listeners
Name | Type |
---|---|
event |
string | symbol |
Returns: Function[]
▸ off(event
: string | symbol, listener
: (...args: any[]) => void): this
Name | Type |
---|---|
event |
string | symbol |
listener |
(...args: any[]) => void |
Returns: this
▸ on(channelName
: string, listener
: typeof channel): this
Overrides void
Sets channel listener event handler
Name | Type | Description |
---|---|---|
channelName |
string | channel name to listen |
listener |
typeof channel | channel event handler |
Returns: this
▸ once(channelName
: string, listener
: typeof channel): this
Sets channel listener event handler which will be fired only one time
Name | Type | Description |
---|---|---|
channelName |
string | channel name to listen |
listener |
typeof channel | channel event handler |
Returns: this
▸ prependListener(event
: string | symbol, listener
: (...args: any[]) => void): this
Inherited from PgClient.prependListener
Name | Type |
---|---|
event |
string | symbol |
listener |
(...args: any[]) => void |
Returns: this
▸ prependOnceListener(event
: string | symbol, listener
: (...args: any[]) => void): this
Inherited from PgClient.prependOnceListener
Name | Type |
---|---|
event |
string | symbol |
listener |
(...args: any[]) => void |
Returns: this
▸ rawListeners(event
: string | symbol): Function[]
Inherited from PgClient.rawListeners
Name | Type |
---|---|
event |
string | symbol |
Returns: Function[]
▸ removeAllListeners(event?
: string | symbol): this
Inherited from PgClient.removeAllListeners
Name | Type |
---|---|
event? |
string | symbol |
Returns: this
▸ removeListener(event
: string | symbol, listener
: (...args: any[]) => void): this
Inherited from PgClient.removeListener
Name | Type |
---|---|
event |
string | symbol |
listener |
(...args: any[]) => void |
Returns: this
▸ setMaxListeners(n
: number): this
Inherited from PgClient.setMaxListeners
Name | Type |
---|---|
n |
number |
Returns: this
▸ Static
listenerCount(emitter
: EventEmitter, event
: string | symbol): number
Inherited from PgChannelEmitter.listenerCount
deprecated
since v4.0.0
Name | Type |
---|---|
emitter |
EventEmitter |
event |
string | symbol |
Returns: number