Dispatch an event from a DOM element
Install
$ npm install --save dispatch-event
Usage
var dispatchEvent = var div = document div // Use the shorthand//=> clicked! // or an already constructed event objectvar event = 'click' button: 2
API
dispatchEvent(element, event, [options])
-> event
Dispatches the event and returns the event.
element
Required
Type: DOMElement
A DOM element on which the event will be dispatched.
event
Required
Type: string
/ event
A full event object or an event name.
options
Type: object
Default: {}
Event options. Only used when event
is a string. When an existing event is passed in, this will be ignored.
License
MIT © Ben Drucker