0.0.104 • Published 3 years ago

@anic/observer v0.0.104

Weekly downloads
-
License
MIT
Repository
-
Last release
3 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

3 years ago

0.0.103

3 years ago

0.0.102

3 years ago

0.0.101

3 years ago

0.0.1

3 years ago