0.0.105 • Published 5 years ago

@anic/onion v0.0.105

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

@anic/onion

Onion for JavaScript

Install

$ yarn add @anic/onion

Usage

import onion from '@anic/onion';

// create
const { add, tap } = onion();

// add Function action
add((type, value) => ({ type, value }));

// add Object action
add({
    value: 1,
    add(num: number): any {
        return this.next(this.value += num;);
    }
});

// tap action
tap('add', 1);

Api

onion(context: Object): { add: Function, tap: Function }

create onion Object, which contain add and tap function;

add(action: Object | Function): () => void

add action, return remove handler;

tap(name: string, ...args: any[]): any

tap action by name and args;

0.0.105

5 years ago

0.0.104

5 years ago

0.0.103

5 years ago

0.0.102

5 years ago

0.0.101

5 years ago