fire-native-event

2.0.0 • Public • Published

fire-native-event

CommonJS module that fires a browser native event.

Should be compatible with IE6+ and reasonable browsers.

It doesn't perform any validation on the provided event object.

It really just fires it, using either Element.prototype.dispatchEvent or Element.prototype.fireEvent.

// Create a native event somehow (this is out of this module's scope)
var createNativeEvent = require("create-event");
var eventType = "click";
var nativeEvent = createNativeEvent(eventType);
 
// Fire it on an element
var element = document.createElement("div");
var fire = require("fire-native-event");
fire(element, nativeEvent, eventType);

Package Sidebar

Install

npm i fire-native-event

Weekly Downloads

2

Version

2.0.0

License

MIT

Last publish

Collaborators

  • mightyiam
  • weswinham