Skip to content

Commit d36152d

Browse files
committed
feat: add off() as alias for removeListener()
1 parent 6c70c3b commit d36152d

2 files changed

Lines changed: 8 additions & 0 deletions

File tree

cjs/src/pg-notify.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,10 @@ class PGPubSub {
7777
this.channels[channel] = { listeners: 1 }
7878
}
7979

80+
async off (channel, listener) {
81+
return this.removeListener(channel, listener)
82+
}
83+
8084
async removeListener (channel, listener) {
8185
if (!this.channels[channel]) {
8286
return

src/pg-notify.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,10 @@ class PGPubSub {
7777
this.channels[channel] = { listeners: 1 }
7878
}
7979

80+
async off (channel, listener) {
81+
return this.removeListener(channel, listener)
82+
}
83+
8084
async removeListener (channel, listener) {
8185
if (!this.channels[channel]) {
8286
return

0 commit comments

Comments
 (0)