@anic/observer
TypeScript icon, indicating that this package has built-in type declarations

0.0.104 • Public • Published

@anic/observer

Observer

Install

$ yarn add @anic/observer

Usage

import observer from '@anic/observer';

// create
const { subscribe, notify } = observer();

// subscribe
const unsubscribe = subscribe((...args) => console.log(args));

// unsubscribe
unsubscribe();

// notify
notify(1, 2, 3);

Class: Observer

subscribe(listener: Function): Function

add listener, return unsubscribe handler.

notify(...args: any[]): Promise

notify observer, return the Promise for all the subscribe handler resolved.

Dependencies (0)

    Dev Dependencies (0)

      Package Sidebar

      Install

      npm i @anic/observer

      Weekly Downloads

      5

      Version

      0.0.104

      License

      MIT

      Unpacked Size

      3.79 kB

      Total Files

      5

      Last publish

      Collaborators

      • absock
      • edonet