tiny-trigger
v0.1.3
Published
Trigger cross-browser DOM events
Downloads
5
Readme
tiny-trigger
Trigger cross-browser DOM events. Works with Browserify and as a standalone.
Install
NPM
npm install tiny-trigger --save
Bower
bower install tiny-trigger --save
<script src="/bower_components/tiny-trigger/dist/tinytrigger.min.js"></script>
Usage
Browserify
var trigger = require('tiny-trigger');
document.querySelector('.some-element').addEventListenr('click', function (e) {
//
});
trigger('.some-element', 'click');
Browser var trigger = window.tinyTrigger;
document.querySelector('.some-element').addEventListenr('click', function (e) {
//
});
trigger('.some-element', 'click');
trigger(selector, event[, multiple])
selector
- css selector OR DOM element OR array of DOM elementsevent
- the name of the event to triggermultple
- if passing in a css selector, should the function find one element or all the elements that match the selector (querySelector vs querySelectorAll)
Run Tests
Requires Phantomjs is installed
npm install
npm test