Create a DOM event
$ npm install @f/create-event
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)
}
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.
MIT