Skip to content

Commit 8b9be7a

Browse files
committed
replace userWhisper with whisper method for private/presence channels
1 parent 1d9bc7e commit 8b9be7a

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,21 +133,21 @@ wrapper.vm.$nextTick(() => {
133133

134134
## Client events
135135

136-
You can use `userWhisper` to send user event. Only private channel object and presence channel object have `userWhisper`.
136+
You can use `whisper` to send user event. Only private channel object and presence channel object have `whisper`.
137137

138138
> Note: If you are using `vue-test-utils`, call `$nextTick` before assertion.
139139
140140
Example:
141141
```javascript
142142
// private channel
143-
mockEcho.getPrivateChannel('meeting').userWhisper('meetingClicking', { username: username })
143+
mockEcho.getPrivateChannel('meeting').whisper('meetingClicking', { username: username })
144144
wrapper.vm.$nextTick(() => {
145145
expect(wrapper.find('.whisper-message').text()).toBe(`${username} is clicking the button`)
146146
done()
147147
})
148148

149149
// presence channel
150-
mockEcho.getPresenceChannel('chat').userWhisper('chatClicking', { username: username })
150+
mockEcho.getPresenceChannel('chat').whisper('chatClicking', { username: username })
151151
wrapper.vm.$nextTick(() => {
152152
expect(wrapper.find('.whisper-message').text()).toBe(`${username} is clicking the button`)
153153
done()

src/index.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class PrivateChannel extends Channel {
3535
this.notificationFn = null
3636
}
3737

38-
userWhisper (eventName, event) {
38+
whisper (eventName, event) {
3939
if (typeof this.clientEvents[`client-${eventName}`] === 'undefined') {
4040
console.error(`Channel didn't listen to client event: ${eventName}`)
4141
return
@@ -56,10 +56,6 @@ class PrivateChannel extends Channel {
5656
notify (notifiable) {
5757
this.notificationFn(notifiable)
5858
}
59-
60-
whisper(eventName, event) {
61-
this.userWhisper(eventName, event);
62-
}
6359
}
6460

6561
class PresenceChannel extends PrivateChannel {

0 commit comments

Comments
 (0)