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.

Consider adding responds(type) method

See original GitHub issue

Would you consider adding such a method that allows to check if the emitter responds to a given event?

EventEmitter.prototype.responds = function(type) {
  return !!(this._all || this._events && this._events[type]);
};

I’m happy to create a PR if this is of use.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
lehnicommented, Mar 29, 2020

I think it would have to be isListeningTo(event) then. But how abouthasListeners([type])? That would work both with and without the type argument.

1reaction
lehnicommented, May 6, 2020

Thanks @DigitalBrainJS for taking care of this, and apologies for being slow (swamped with work currently…)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Response.type - Web APIs - MDN Web Docs
The type read-only property of the Response interface contains the type of the response. It can be one of the following:
Read more >
HTTP/1.1: Method Definitions
The OPTIONS method represents a request for information about the communication options available on the request/response chain identified by the Request-URI.
Read more >
HTTP Request Methods – Get vs Put vs Post Explained with ...
In this article, we'll be discussing the get, put, and post HTTP methods. You'll learn what each HTTP method is used for as...
Read more >
10 Tips for Responding Graciously to Customer Feature ...
I like to think of this situation as a two-way street. When customers make the effort to offer a feature request or suggestion,...
Read more >
Chapter 7. Representations and Responses
Given the following method, the most acceptable media type is used when ... Returning 201 status code and adding Location header in response...
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