Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/azproduction/decl
Declarative constructors
https://github.com/azproduction/decl
Last synced: 22 days ago
JSON representation
Declarative constructors
- Host: GitHub
- URL: https://github.com/azproduction/decl
- Owner: azproduction
- License: mit
- Created: 2014-02-01T13:38:56.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2014-02-01T14:26:08.000Z (almost 11 years ago)
- Last Synced: 2024-04-15T12:20:57.812Z (7 months ago)
- Language: JavaScript
- Homepage:
- Size: 121 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
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
```