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.

Wildcard listener not invoked when also matching exact listener

See original GitHub issue

If an event matches both a listener with a wildcard and a listener without, only the non-wildcard listener is invoked. A wildcard listener should not be dependent on if another listener has a “better match”. If this is actually intended behaviour, maybe an option on the constructor could provide both.

Steps to reproduce:

const EventEmitter2 = require('eventemitter2');
const ee = new EventEmitter2({ wildcard: true });

ee.on('A', console.log);
ee.on('B.**', console.log);
ee.on('C', console.log);
ee.on('C.**', console.log);

ee.emit('A', 'A'); // Logs "A" once
ee.emit('B', 'B'); // Logs "B" once
ee.emit('C', 'C'); // Logs "C" only once, not matching wildcard C.**

Expected result A B C C

Actual result A B C

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
RangerMauvecommented, Oct 3, 2021

@DigitalBrainJS Thank you! Just released v6.4.5 on NPM. 😁

1reaction
DigitalBrainJScommented, Oct 3, 2021

@thorsby Thanks for reporting! I have just fixed this bug and when @RangerMauve has time he will release a new v6.4.5 version with this change.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Acknowledging the message on wildcard-address does not ...
Once the processing is successful at the listener, the message is acknowledged at the wildcard-address ( /queue/app/* ), but not the original ...
Read more >
Listeners for your Application Load Balancers
Wildcard characters are not supported; therefore, the method name must be an exact match. We recommend that you route GET and HEAD requests...
Read more >
Listener components (proto) - Envoy Proxy
FilterChainMatch. Specifies the match criteria for selecting a specific filter chain for a listener. In order for a filter chain to be selected,...
Read more >
Configure HTTP Listener Source - Mule 4
Wildcards at the end of a path can help provide better error messages by capturing requests to unmanaged resources. Parameters ( {param} )...
Read more >
Using the EventManager - Zend Framework 2 - Read the Docs
This is because those are often not stored in the object, and also to ensure the listeners have the exact same context as...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

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