# good-listener
**Repository Path**: mirrors_addons/good-listener
## Basic Information
- **Project Name**: good-listener
- **Description**: A more versatile way of adding & removing event listeners
- **Primary Language**: Unknown
- **License**: Not specified
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 0
- **Created**: 2020-05-03
- **Last Updated**: 2025-09-06
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
# good-listener
[](https://travis-ci.org/zenorocha/good-listener)
> A more versatile way of adding & removing event listeners.

## Install
You can get it on npm.
```
npm install good-listener --save
```
Or bower, too.
```
bower install good-listener --save
```
If you're not into package management, just [download a ZIP](https://github.com/zenorocha/good-listener/archive/master.zip) file.
## Setup
###### Node (Browserify)
```js
var listen = require('good-listener');
```
###### Browser (Standalone)
```html
```
## Usage
### Add an event listener
By passing a string selector [(see full demo)](https://github.com/zenorocha/good-listener/blob/master/demo/selector.html).
```js
listen('.btn', 'click', function(e) {
console.log(e);
});
```
Or by passing a HTML element [(see full demo)](https://github.com/zenorocha/good-listener/blob/master/demo/node.html).
```js
var logo = document.getElementById('logo');
listen(logo, 'click', function(e) {
console.log(e);
});
```
Or by passing a list of HTML elements [(see full demo)](https://github.com/zenorocha/good-listener/blob/master/demo/nodelist.html).
```js
var anchors = document.querySelectorAll('a');
listen(anchors, 'click', function(e) {
console.log(e);
});
```
### Remove an event listener
By calling the `destroy` function that returned from previous operation [(see full demo)](https://github.com/zenorocha/good-listener/blob/master/demo/destroy.html).
```js
var listener = listen('.btn', 'click', function(e) {
console.log(e);
});
listener.destroy();
```
## Browser Support
|
|
|
|
|
|
|
|:---:|:---:|:---:|:---:|:---:|:---:|
| Latest ✔ | Latest ✔ | Latest ✔ | 9+ ✔ | Latest ✔ | Latest ✔ |
## License
[MIT License](http://zenorocha.mit-license.org/) © Zeno Rocha