Skip to content

PgChannelEmitter

Mykhailo Stadnyk edited this page Mar 18, 2020 · 4 revisions

Class: PgChannelEmitter

Implements event emitting/subscribing on PostgreSQL LISTEN/NOTIFY named channels.

Hierarchy

  • EventEmitter

    PgChannelEmitter

Index

Constructors

Events

Properties

Methods

Constructors

constructor

+ new PgChannelEmitter(options?: EventEmitterOptions): PgChannelEmitter

Inherited from PgChannelEmitter.constructor

Parameters:

Name Type
options? EventEmitterOptions

Returns: PgChannelEmitter

Events

channel

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

Properties

Static defaultMaxListeners

defaultMaxListeners: number

Inherited from PgChannelEmitter.defaultMaxListeners

Methods

addListener

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

emit(event: string | symbol, ...args: any[]): boolean

Inherited from PgClient.emit

Parameters:

Name Type
event string | symbol
...args any[]

Returns: boolean


eventNames

eventNames(): Array‹string | symbol›

Inherited from PgClient.eventNames

Returns: Array‹string | symbol›


getMaxListeners

getMaxListeners(): number

Inherited from PgClient.getMaxListeners

Returns: number


listenerCount

listenerCount(type: string | symbol): number

Inherited from PgClient.listenerCount

Parameters:

Name Type
type string | symbol

Returns: number


listeners

listeners(event: string | symbol): Function[]

Inherited from PgClient.listeners

Parameters:

Name Type
event string | symbol

Returns: Function[]


off

off(event: string | symbol, listener: function): this

Inherited from PgClient.off

Parameters:

event: string | symbol

listener: function

▸ (...args: any[]): void

Parameters:

Name Type
...args any[]

Returns: this


on

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

once(channelName: string, listener: typeof channel): this

Overrides PgClient.once

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

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

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

rawListeners(event: string | symbol): Function[]

Inherited from PgClient.rawListeners

Parameters:

Name Type
event string | symbol

Returns: Function[]


removeAllListeners

removeAllListeners(event?: string | symbol): this

Inherited from PgClient.removeAllListeners

Parameters:

Name Type
event? string | symbol

Returns: this


removeListener

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

setMaxListeners(n: number): this

Inherited from PgClient.setMaxListeners

Parameters:

Name Type
n number

Returns: this


Static listenerCount

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

Clone this wiki locally