create-event
Create a DOM event
Installation
$ npm install @f/create-event
Usage
You can use this library to trigger synthetic events on elements for testing or other purposes. E.g.s
var createEvent = require('@f/create-event')
function triggerEvent (node, type, opts) {
var e = createEvent(type, opts)
node.dispatchEvent(e)
}
API
createEvent(type, opts)
-
type
- The name of the event. E.g.mouseover
orclick
. -
opts
- Optional. Object containing special properties you want to set on the event. These will be event-specific.
Returns: A DOM event object created by the appropriate event constructor.
License
MIT