Consider adding responds(type) method
See original GitHub issueWould 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:
- Created 3 years ago
- Reactions:1
- Comments:7 (4 by maintainers)
Top 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 >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
I think it would have to be
isListeningTo(event)
then. But how abouthasListeners([type])
? That would work both with and without thetype
argument.Thanks @DigitalBrainJS for taking care of this, and apologies for being slow (swamped with work currently…)