1.0.2 • Published 8 years ago

@f/create-event v1.0.2

Weekly downloads
1
License
MIT
Repository
github
Last release
8 years ago

create-event

Build status Git tag NPM version Code style

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 or click.
  • 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