-
Notifications
You must be signed in to change notification settings - Fork 9
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
Parameters:
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
Parameters:
Name | Type | Description |
---|---|---|
payload |
AnyJson | event payload |
Returns: void
▪ defaultMaxListeners: number
Inherited from PgChannelEmitter.defaultMaxListeners
▸ addListener(event
: string | symbol, listener
: function): this
Inherited from PgClient.addListener
Parameters:
▪ event: string | symbol
▪ listener: function
▸ (...args
: any[]): void
Parameters:
Name | Type |
---|---|
...args |
any[] |
Returns: this
▸ emit(event
: string | symbol, ...args
: any[]): boolean
Parameters:
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(type
: string | symbol): number
Inherited from PgClient.listenerCount
Parameters:
Name | Type |
---|---|
type |
string | symbol |
Returns: number
▸ listeners(event
: string | symbol): Function[]
Inherited from PgClient.listeners
Parameters:
Name | Type |
---|---|
event |
string | symbol |
Returns: Function[]
▸ off(event
: string | symbol, listener
: function): this
Parameters:
▪ event: string | symbol
▪ listener: function
▸ (...args
: any[]): void
Parameters:
Name | Type |
---|---|
...args |
any[] |
Returns: this
▸ on(channelName
: string, listener
: typeof channel): this
Overrides void
Sets channel listener event handler
Parameters:
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
Parameters:
Name | Type | Description |
---|---|---|
channelName |
string | channel name to listen |
listener |
typeof channel | channel event handler |
Returns: this
▸ prependListener(event
: string | symbol, listener
: function): this
Inherited from PgClient.prependListener
Parameters:
▪ event: string | symbol
▪ listener: function
▸ (...args
: any[]): void
Parameters:
Name | Type |
---|---|
...args |
any[] |
Returns: this
▸ prependOnceListener(event
: string | symbol, listener
: function): this
Inherited from PgClient.prependOnceListener
Parameters:
▪ event: string | symbol
▪ listener: function
▸ (...args
: any[]): void
Parameters:
Name | Type |
---|---|
...args |
any[] |
Returns: this
▸ rawListeners(event
: string | symbol): Function[]
Inherited from PgClient.rawListeners
Parameters:
Name | Type |
---|---|
event |
string | symbol |
Returns: Function[]
▸ removeAllListeners(event?
: string | symbol): this
Inherited from PgClient.removeAllListeners
Parameters:
Name | Type |
---|---|
event? |
string | symbol |
Returns: this
▸ removeListener(event
: string | symbol, listener
: function): this
Inherited from PgClient.removeListener
Parameters:
▪ event: string | symbol
▪ listener: function
▸ (...args
: any[]): void
Parameters:
Name | Type |
---|---|
...args |
any[] |
Returns: this
▸ setMaxListeners(n
: number): this
Inherited from PgClient.setMaxListeners
Parameters:
Name | Type |
---|---|
n |
number |
Returns: this
▸ listenerCount(emitter
: EventEmitter, event
: string | symbol): number
Inherited from PgChannelEmitter.listenerCount
deprecated
since v4.0.0
Parameters:
Name | Type |
---|---|
emitter |
EventEmitter |
event |
string | symbol |
Returns: number