Eventr - a JavaScript event simulator
Code initially based on Protolicious, made library agnostic by a user on stackoverflow and was then made into a CoffeeScript module.
Usage
There is only one public static method:
Eventr.simulate(element, eventName [, options]) -> DOMElement
where
-
elementis the DOM element to fire the event on -
eventNameis the name of event to fire. Currently only MouseEvents and HTMLEvents interfaces are supported, which include:-
load,unload,abort,error,select,change,submit,reset,focus,blur,resize,scroll -
click,dblclick,mousedown,mouseup,mouseover,mousemove,mouseout
-
-
optionsis an optional object to fine-tune event properties like:-
pointerX,pointerY,button,ctrlKey,altKey,shiftKey,metaKey,bubbles,cancelable, etc.
-
Returned is the target element for convenient chaining (well at least as easy as it gets with static methods :).
Building from source
Just run grunt.
Version history
- [2014-11-19] - 0.2.0: build tools, min version, bower component
- [2013-01-11] - 0.1: initial version
License
MIT License, see LICENSE.md