Package Exports
- run-event-handler-once
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (run-event-handler-once) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
run-event-handler-once
Attach an event handler to the specified element and ensure that the event handler is executed only once.
Installation
Install run-event-handler-once using npm:
npm install --save run-event-handler-once
Or via yarn:
yarn add run-event-handler-once
Usage
const runEventHandlerOnce = require('run-event-handler-once');
const button = document.querySelector('button');
runEventHandlerOnce(button, 'click', function() {
console.log('Hello!');
});API
runEventHandlerOnce(target, type, listener, [options])
target
Type: EventTarget
The event target to listen for the event on.
type
Type: string
The event type to listen for.
listener
Type: function
An event handler that is called when a specific event type occurs.
options (Optional)
Type: object
An options object. It has two keys: add an options object that will be passed to addEventListener and remove an options object that will be passed to removeEventListener.
License
MIT