question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

how to catch all events?

See original GitHub issue

Hi,

if there a possibility to use VM $on() method to catch all incoming events? It would be even cooler to enable wildcards like:

this.vm.$on('delete-*', function(){
//...
});

to catch all events starting with ‘delete-’

Right now such functionality is useful for me for diagnostics, but I think it would be useful in several other scenarios as well.

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:14 (1 by maintainers)

github_iconTop GitHub Comments

47reactions
phyruncommented, Nov 30, 2017

i very stress

18reactions
endoplasmiccommented, Jul 20, 2017

For those looking to do the same thing with version 1.0+, the syntax is like this:

const old_on = this.$on;
this.$on = (...args) => {
  // custom logic here like pushing to a callback array or something
  old_on.apply(this, args);
};
Read more comments on GitHub >

github_iconTop Results From Across the Web

Is it possible to programmatically catch all events on the page ...
For all native events, we can retrieve a list of supported events by iterating over the target.onevent properties and installing our listener for...
Read more >
JavaScript Event Madness! Capturing *all* events without ...
The client side script component of Ghostlab is listening for all sorts of events that happen, tries to catch them, and replicate them...
Read more >
How to log all JavaScript events to console for debugging
Note that if you want to stop listening for events again, you simply use unmonitorEvents . Example: Log all click events of the...
Read more >
Javascript tips: list EVERY event that exists in the browser
Then, we'll have to iterate all of window 's own properties, and get all of the events supported by those properties (e.g. XMLHttpRequest...
Read more >
Introduction to events - Learn web development | MDN
Events are actions or occurrences that happen in the system you are ... You can find HTML attribute equivalents for many of the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found