@f/trigger-event

1.0.2 • Public • Published

trigger-event

Build status Git tag NPM version Code style

Modern, simple event triggering utility that works with more events than most other things out there.

Installation

$ npm install @f/trigger-event

Usage

Use it to trigger synthetic events on elements. Particularly useful for testing.

var trigger = require('@f/trigger-event')

function simulateClick (node) {
  trigger(node, 'click')
}

API

triggerEvent(node, type, opts)

  • node - The DOM node you want to trigger the event on.
  • type - The event type (e.g. mouseover, click, etc.)
  • opts - Optional. Specify options to be passed to the particular event in question. E.g. keycode. If you want to know what properties are available for your particular event, consult the documentation.

Returns: void

License

MIT

/@f/trigger-event/

    Package Sidebar

    Install

    npm i @f/trigger-event

    Weekly Downloads

    6

    Version

    1.0.2

    License

    MIT

    Last publish

    Collaborators

    • f