Request: add `unlisten` method
See original GitHub issueI need to stop listening for some events when the route changes (client-side). Currently I use leave(channel)
, however, this might unsubscribe
other events that were registered somewhere else in the app.
Issue Analytics
- State:
- Created 7 years ago
- Reactions:25
- Comments:14 (1 by maintainers)
Top Results From Across the Web
Unlisten Method
Unlisten Method. In This Topic. Description; Syntax; Parameters; Remarks; See Also. Description. Closes a 'listening' TCP port.
Read more >JS - keyboard events - listen / unlisten - Stack Overflow
As it is possible to add many Swipes on the same page, I start to listen the keydown events only when any Swipe...
Read more >EventTarget.removeEventListener() - Web APIs | MDN
The removeEventListener() method of the EventTarget interface removes an event listener previously registered with EventTarget.
Read more >Four ways of listening to DOM events in Angular (Part 3
addEventListener in the following way: nativeElement.addEventListener("mousemove", onMouseMove);. To remove this event listener, we need to call .
Read more >@puttest.io/put-jayson - npm
const jayson = require('jayson'); // create a server const server = new jayson.Server({ add: function(args, callback) { callback(null, args[0] + args[1]); } ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
window.Echo.leave('channel-name')
The
stopListening
method will only work with pusher driver.With SocketIO there is no way to remove a previously added listener through Echo. The only way is to use the SocketIO API directly.
Adding a listener :
Removing the listener :
But with this method you may verify the channel provenance as it will listen all subscriptions.
If we want a straightforward native solution we may need to add a way for reverting the
on
method :unbind
to be specific instead of globallistener
for reusing him for the removalunlisten
with :