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

0.0.104 • Public • Published

@ainc/observer

Observer

Install

$ yarn add @ainc/observer

Usage

import observer from '@ainc/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 @ainc/observer

      Weekly Downloads

      0

      Version

      0.0.104

      License

      MIT

      Unpacked Size

      9.79 kB

      Total Files

      12

      Last publish

      Collaborators

      • absock
      • edonet