1.0.2 • Published 1 year ago

@angx-o/dispatcher v1.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

a simple middleware dispatcher

import { Dispatcher } from "@angx-o/dispatcher"

const dispatcher = new Dispatcher();

dispatcher.use(
  async (next) => {
    console.log(1);
    await next();
    console.log(2);
  },
    console.log(3);
    await next();
    console.log(4);
  }
)

dispatcher
  .dispatch(async () => {
    console.log(5)
  })
  .then(() => {
    console.log(6)
  })

// output 1 3 5 4 2 6
1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago