1.1.0 • Published 6 months ago

subscription-listener v1.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
6 months ago

subscription-listener

A lite weight library used for subscribing to an event and dispatching

Examples

import SubscriptionListener from "subscription-listener";

const emittion = new SubscriptionListener();

// trigger value
emittion.dispatch("my-custom-event", "rice", "monday");

// listen to events
const unsubscribe = emittion.listenTo("my-custom-event", (food, day) => {
  // this should emit food=rice, day=monday
  console.log(`food: ${food} and day: ${day}`);
});
// then after if you want to stop receiving event
unsubscribe();

// check if an event has been called
emittion.hasDispatched("my-custom-event");

// delete an event value that was called
emittion.deleteDispatch("my-custom-event");
1.1.0

6 months ago

1.0.9

9 months ago

1.0.7

9 months ago

1.0.6

9 months ago

1.0.5

9 months ago

1.0.4

9 months ago

1.0.3

9 months ago

1.0.2

9 months ago

1.0.1

9 months ago

1.0.0

9 months ago