laravel-echo
Advanced tools
Comparing version 1.10.0 to 1.11.0
@@ -19,1 +19,4 @@ --- | ||
### Steps To Reproduce: | ||
<!-- If possible, please provide a GitHub repository to demonstrate your issue --> | ||
<!-- laravel new bug-report --github="--public" --> |
# Release Notes | ||
## [Unreleased](https://github.com/laravel/echo/compare/v1.9.0...master) | ||
## [Unreleased](https://github.com/laravel/echo/compare/v1.10.0...master) | ||
## [v1.10.0 (2020-12-19)](https://github.com/laravel/echo/compare/v1.9.0...v1.10.0) | ||
### Added | ||
- Add optional callback argument to `stopListening()` ([#292](https://github.com/laravel/echo/pull/292)) | ||
## [v1.9.0 (2020-10-13)](https://github.com/laravel/echo/compare/v1.8.1...v1.9.0) | ||
@@ -7,0 +13,0 @@ |
@@ -44,2 +44,6 @@ import { EventFormatter } from '../util'; | ||
/** | ||
* Listen for all events on the channel instance. | ||
*/ | ||
listenToAll(callback: Function): PusherChannel; | ||
/** | ||
* Stop listening for an event on the channel instance. | ||
@@ -49,2 +53,6 @@ */ | ||
/** | ||
* Stop listening for all events on the channel instance. | ||
*/ | ||
stopListeningToAll(callback?: Function): PusherChannel; | ||
/** | ||
* Register a callback to be called anytime a subscription succeeds. | ||
@@ -51,0 +59,0 @@ */ |
@@ -325,2 +325,23 @@ 'use strict'; | ||
/** | ||
* Listen for all events on the channel instance. | ||
*/ | ||
}, { | ||
key: "listenToAll", | ||
value: function listenToAll(callback) { | ||
var _this2 = this; | ||
this.subscription.bind_global(function (event, data) { | ||
if (event.startsWith('pusher:')) { | ||
return; | ||
} | ||
var namespace = _this2.options.namespace.replace(/\./g, '\\'); | ||
var formattedEvent = event.startsWith(namespace) ? event.substring(namespace.length + 1) : '.' + event; | ||
callback(formattedEvent, data); | ||
}); | ||
return this; | ||
} | ||
/** | ||
* Stop listening for an event on the channel instance. | ||
@@ -341,2 +362,17 @@ */ | ||
/** | ||
* Stop listening for all events on the channel instance. | ||
*/ | ||
}, { | ||
key: "stopListeningToAll", | ||
value: function stopListeningToAll(callback) { | ||
if (callback) { | ||
this.subscription.unbind_global(callback); | ||
} else { | ||
this.subscription.unbind_global(); | ||
} | ||
return this; | ||
} | ||
/** | ||
* Register a callback to be called anytime a subscription succeeds. | ||
@@ -343,0 +379,0 @@ */ |
@@ -326,2 +326,23 @@ var Echo = (function () { | ||
/** | ||
* Listen for all events on the channel instance. | ||
*/ | ||
}, { | ||
key: "listenToAll", | ||
value: function listenToAll(callback) { | ||
var _this2 = this; | ||
this.subscription.bind_global(function (event, data) { | ||
if (event.startsWith('pusher:')) { | ||
return; | ||
} | ||
var namespace = _this2.options.namespace.replace(/\./g, '\\'); | ||
var formattedEvent = event.startsWith(namespace) ? event.substring(namespace.length + 1) : '.' + event; | ||
callback(formattedEvent, data); | ||
}); | ||
return this; | ||
} | ||
/** | ||
* Stop listening for an event on the channel instance. | ||
@@ -342,2 +363,17 @@ */ | ||
/** | ||
* Stop listening for all events on the channel instance. | ||
*/ | ||
}, { | ||
key: "stopListeningToAll", | ||
value: function stopListeningToAll(callback) { | ||
if (callback) { | ||
this.subscription.unbind_global(callback); | ||
} else { | ||
this.subscription.unbind_global(); | ||
} | ||
return this; | ||
} | ||
/** | ||
* Register a callback to be called anytime a subscription succeeds. | ||
@@ -344,0 +380,0 @@ */ |
@@ -323,2 +323,23 @@ function _classCallCheck(instance, Constructor) { | ||
/** | ||
* Listen for all events on the channel instance. | ||
*/ | ||
}, { | ||
key: "listenToAll", | ||
value: function listenToAll(callback) { | ||
var _this2 = this; | ||
this.subscription.bind_global(function (event, data) { | ||
if (event.startsWith('pusher:')) { | ||
return; | ||
} | ||
var namespace = _this2.options.namespace.replace(/\./g, '\\'); | ||
var formattedEvent = event.startsWith(namespace) ? event.substring(namespace.length + 1) : '.' + event; | ||
callback(formattedEvent, data); | ||
}); | ||
return this; | ||
} | ||
/** | ||
* Stop listening for an event on the channel instance. | ||
@@ -339,2 +360,17 @@ */ | ||
/** | ||
* Stop listening for all events on the channel instance. | ||
*/ | ||
}, { | ||
key: "stopListeningToAll", | ||
value: function stopListeningToAll(callback) { | ||
if (callback) { | ||
this.subscription.unbind_global(callback); | ||
} else { | ||
this.subscription.unbind_global(); | ||
} | ||
return this; | ||
} | ||
/** | ||
* Register a callback to be called anytime a subscription succeeds. | ||
@@ -341,0 +377,0 @@ */ |
{ | ||
"name": "laravel-echo", | ||
"version": "1.10.0", | ||
"version": "1.11.0", | ||
"description": "Laravel Echo library for beautiful Pusher and Socket.IO integration", | ||
@@ -8,3 +8,3 @@ "keywords": [ | ||
"pusher", | ||
"socket.io" | ||
"ably" | ||
], | ||
@@ -11,0 +11,0 @@ "homepage": "https://github.com/laravel/echo", |
@@ -1,2 +0,2 @@ | ||
<p align="center"><img src="https://laravel.com/assets/img/components/logo-echo.svg"></p> | ||
<p align="center"><img src="/art/logo.svg" alt="Logo Laravel Echo"></p> | ||
@@ -3,0 +3,0 @@ <p align="center"> |
@@ -71,2 +71,21 @@ import { EventFormatter } from '../util'; | ||
/** | ||
* Listen for all events on the channel instance. | ||
*/ | ||
listenToAll(callback: Function): PusherChannel { | ||
this.subscription.bind_global((event, data) => { | ||
if (event.startsWith('pusher:')) { | ||
return; | ||
} | ||
let namespace = this.options.namespace.replace(/\./g, '\\'); | ||
let formattedEvent = event.startsWith(namespace) ? event.substring(namespace.length + 1) : '.' + event; | ||
callback(formattedEvent, data); | ||
}); | ||
return this; | ||
} | ||
/** | ||
* Stop listening for an event on the channel instance. | ||
@@ -85,2 +104,15 @@ */ | ||
/** | ||
* Stop listening for all events on the channel instance. | ||
*/ | ||
stopListeningToAll(callback?: Function): PusherChannel { | ||
if (callback) { | ||
this.subscription.unbind_global(callback); | ||
} else { | ||
this.subscription.unbind_global(); | ||
} | ||
return this; | ||
} | ||
/** | ||
* Register a callback to be called anytime a subscription succeeds. | ||
@@ -87,0 +119,0 @@ */ |
@@ -116,3 +116,3 @@ import { EventFormatter } from '../util'; | ||
if (! this.events[event]) { | ||
if (!this.events[event]) { | ||
this.events[event] = (channel, data) => { | ||
@@ -119,0 +119,0 @@ if (this.name === channel && this.listeners[event]) { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
188492
70
5785