0.0.1 • Published 5 years ago

create-notifier v0.0.1

Weekly downloads
2
License
MIT
Repository
github
Last release
5 years ago

create-notifier

Lightweight notifier implementation.

Notifier is a source, that you can subscribe to its update events, but it doesn't propagate any values.

Install

npm install create-notifier

createNotifier

import { createNotifier } from "create-notifier";

const notifier = createNotifier();
// It tracks age and increase it with every `notify` call
notifier.getAge(); // 0
// We can subscribe, to get notified
const unsubscribe = notifier.subscribe(() =>
  console.log("This is subscription")
);

notifier.notify();
// Logs 'This is subscription'
notifier.getAge(); // 1