This package has been deprecated

Author message:

Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

event-stack-factory

1.0.1 • Public • Published

event-stack-factory

Utility for handling global Event Listeners which attached to window

How to use:
Initializing Event Stack
import { eventStackFactory } from 'event-stack-factory';

const EventStack = eventStackFactory(options); // *

See detailed about options *

Pushing new listener to stack

This operation adds new listener to Event Emitter and deletes previous, if exists

const eventListener = event => console.log(event.target.value);

EventStack.push({
  click: eventListener,
  keydown: eventListener,
}) // etc.
Removing listener from stack

This operation deletes latest listener from Event Emitter and sets previous, if exists

EventStack.pop();

If Stack is not empty will fires only last added Event Listener. Useful for "Escape" keydown or "Click" for several opened modal.

Package Sidebar

Install

npm i event-stack-factory

Weekly Downloads

1

Version

1.0.1

License

MIT

Unpacked Size

33.7 kB

Total Files

14

Last publish

Collaborators

  • tarasromil