Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/azproduction/decl

Declarative constructors
https://github.com/azproduction/decl

Last synced: 22 days ago
JSON representation

Declarative constructors

Awesome Lists containing this project

README

        

# decl

Declarative elements constructors

## Installation

`decl` can be installed using `bower`:

```bash
$ bower install azproduction/decl
```

## Example

```js
function countBuyers(e) {
var action = ['send', 'event'].concat(event.target.dataset.counter.split(' '));
ga.apply(this, action);
}

decl('[data-counter]', function (el) {
// in case of double call
el.removeEventListener('click', countBuyers, false);
el.addEventListener('click' countBuyers, false);
});

setTimeout(decl.init, 0); // DOM Ready
```

```html

Buy
```