simulate-events
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

Build Status

Simulate events

A tiny helper library to simulate any kind of event in non-browser environments like jsdom. Events do work the same as you would exepect them to work in a browser.

Installation

# NPM 
npm i -D simulate-events
 
# Yarn 
yarn add --dev simulate-events

Usage

import fire from "simulate-events";
 
// We assume that jsdom has been correctly set up
const div = document.createElement("div");
document.body.appendChild(div);
 
div.addEventListener("whatever", () => {
  console.log("hey");
});
 
fire(div, "whatever");
 
// Logs: "hey"

LICENSE

MIT, see LICENSE.md

Readme

Keywords

none

Package Sidebar

Install

npm i simulate-events

Weekly Downloads

3

Version

1.0.0

License

MIT

Last publish

Collaborators

  • marvinhagemeister