/eventr

A JavaScript event simulator

Primary LanguageCoffeeScriptMIT LicenseMIT

Build Status Eventr - a JavaScript event simulator

Greenkeeper badge

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

  • element is the DOM element to fire the event on
  • eventName is 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
  • options is 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