trigger-event

1.0.5 • Public • Published

trigger-event

Programmatically trigger a DOM event.

Rewrite of ianstormtaylor/trigger-event for npm+browserify support.

Example

var triggerEvent = require('trigger-event');

triggerEvent(document, 'keydown', {key: 'enter'});
triggerEvent('keydown', {key: 'enter'})

Installation

$ npm install trigger-event

API

var triggerEvent = require('trigger-event');

triggerEvent([element, ]type[, options])

Programmatically triggers a DOM event of type:

  • 'click'
  • 'dblclick'
  • 'keydown'
  • 'keyup'

document is used if element is not provided.

Default options:

{
  alt: false,
  bubbles: true,
  button: 0,
  cancelable: true,
  clientX: 0,
  clientY: 0,
  ctrl: false,
  detail: 1,
  key: 0,
  meta: false,
  relatedTarget: null,
  screenX: 0,
  screenY: 0,
  shift: false,
  view: window
}

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
1.0.5526latest

Version History

VersionDownloads (Last 7 Days)Published
1.0.5526
1.0.40
1.0.312
1.0.20
1.0.10
1.0.00

Package Sidebar

Install

npm i trigger-event

Weekly Downloads

538

Version

1.0.5

License

MIT

Unpacked Size

3.76 kB

Total Files

4

Last publish

Collaborators

  • kenan