Skip to content

Middleware framework based on Async Generator of ECMAScript 2018, inspired by Koa 2

Notifications You must be signed in to change notification settings

TechQuery/onion-stack

Repository files navigation

OnionStack

Middleware framework based on Async Generator & TypeScript, inspired by Koa 2.

NPM Dependency CI & CD

NPM

Example

import OnionStack from 'onion-stack';

const list = [];

const stack = new OnionStack(
    function* () {
        list.push(1);

        yield;

        list.push(2);

        yield;

        list.push(3);
    },
    async function* () {
        await delay(0.1);

        list.push(4);

        yield;

        list.push(5);
    },
    function () {
        list.push(6);
    }
);

stack.execute().then(() => console.log(list)); //  [1, 4, 6, 5, 2]

More cases

About

Middleware framework based on Async Generator of ECMAScript 2018, inspired by Koa 2

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published