0.0.104 • Published 5 years ago

@anic/observer v0.0.104

Weekly downloads
-
License
MIT
Repository
-
Last release
5 years ago

@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.

0.0.104

5 years ago

0.0.103

5 years ago

0.0.102

5 years ago

0.0.101

5 years ago

0.0.1

5 years ago