# bianco.events

[![Build Status][ci-image]][ci-url]
[![NPM version][npm-version-image]][npm-url]
[![NPM downloads][npm-downloads-image]][npm-url]
[![MIT License][license-image]][license-url]

Modern DOM events helpers written in es2015

This script will not be transpiled and it is only thought to be part of your build chain.

## Usage

```js
import { add, remove, once } from 'bianco.events'

add(node/s, 'click mouseenter', function(e) {
  console.log('tadaaa!')
})
```

[ci-image]:https://img.shields.io/github/workflow/status/biancojs/events/test?style=flat-square
[ci-url]:https://github.com/biancojs/events/actions

[license-image]: http://img.shields.io/badge/license-MIT-000000.svg?style=flat-square

[license-url]: LICENSE.txt
[npm-version-image]: http://img.shields.io/npm/v/bianco.events.svg?style=flat-square

[npm-downloads-image]: http://img.shields.io/npm/dm/bianco.events.svg?style=flat-square
[npm-url]: https://npmjs.org/package/bianco.events

## API

<!-- Generated by documentation.js. Update this documentation by updating the source code. -->

#### Table of Contents

-   [add](#add)
    -   [Parameters](#parameters)
-   [once](#once)
    -   [Parameters](#parameters-1)
-   [remove](#remove)
    -   [Parameters](#parameters-2)

### add

Set a listener for all the events received separated by spaces

#### Parameters

-   `els` **([HTMLElement](https://developer.mozilla.org/docs/Web/HTML/Element) \| [Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array))** DOM node/s where the listeners will be bound
-   `evList` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** list of events we want to bind space separated
-   `cb` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** listeners callback
-   `options` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** event options (capture, once and passive)

Returns **([HTMLElement](https://developer.mozilla.org/docs/Web/HTML/Element) \| [NodeList](https://developer.mozilla.org/docs/Web/API/NodeList) \| [Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array))** DOM node/s and first argument of the function

### once

Set a listener using from a list of events triggering the callback only once

#### Parameters

-   `els` **([HTMLElement](https://developer.mozilla.org/docs/Web/HTML/Element) \| [Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array))** DOM node where the listeners will be bound
-   `evList` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** list of events we want to bind space separated
-   `cb` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** listeners callback
-   `options` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** event options (capture, once and passive)

Returns **([HTMLElement](https://developer.mozilla.org/docs/Web/HTML/Element) \| [NodeList](https://developer.mozilla.org/docs/Web/API/NodeList) \| [Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array))** DOM node/s and first argument of the function

### remove

Remove all the listeners for the events received separated by spaces

#### Parameters

-   `els` **([HTMLElement](https://developer.mozilla.org/docs/Web/HTML/Element) \| [Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array))** DOM node/s where the events will be unbind
-   `evList` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** list of events we want unbind space separated
-   `cb` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** listeners callback
-   `options` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** event options (capture, once and passive)

Returns **([HTMLElement](https://developer.mozilla.org/docs/Web/HTML/Element) \| [NodeList](https://developer.mozilla.org/docs/Web/API/NodeList) \| [Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array))** DOM node/s and first argument of the function
