@segment/create-event

Create an event object cross browser. Useful for unit testing mostly.

Stats

stars 🌟issues ⚠️updated 🛠created 🐣size 🏋️‍♀️
20May 18, 2016May 18, 2016Minified + gzip package size for @segment/create-event in KB

Readme

create-event

CircleCI Codecov

Create an event object cross browser. Useful for unit testing mostly.

Installation

$ npm install @segment/create-event

Example

var create = require('create-event');
var event = create('keydown', {
  ctrl: true,
  key: 'enter'
});

API

createEvent(type, [options])

Types:

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

Default options:

alt        : false,
bubbles    : true,
button     : 0,
cancelable : true,
clientX    : 0,
clientY    : 0,
ctrl       : false,
detail     : 1,
key        : 0, // can be a string like 'enter' for convenience
meta       : false,
screenX    : 0,
screenY    : 0,
shift      : false,
view       : window

If you find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from npms.io.