1.0.2 • Published 8 years ago
@f/trigger-event v1.0.2
trigger-event
Modern, simple event triggering utility that works with more events than most other things out there.
Installation
$ npm install @f/trigger-event
Usage
Use it to trigger synthetic events on elements. Particularly useful for testing.
var trigger = require('@f/trigger-event')
function simulateClick (node) {
trigger(node, 'click')
}
API
triggerEvent(node, type, opts)
node
- The DOM node you want to trigger the event on.type
- The event type (e.g.mouseover
,click
, etc.)opts
- Optional. Specify options to be passed to the particular event in question. E.g.keycode
. If you want to know what properties are available for your particular event, consult the documentation.
Returns: void
License
MIT