npm

Ready to take your JavaScript development to the next level? Meet npm Enterprise - the ultimate in enterprise JavaScript.Learn more »

onion-stack

0.2.0 • Public • Published

OnionStack

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

NPM Dependency Build Status

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

install

npm i onion-stack

Downloadsweekly downloads

1

version

0.2.0

license

LGPL-3.0

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability