Skip to content

malgogi/straw

Repository files navigation

malgogi-rx-straw

Description

malgogi-rx-straw is rxjs utility library.

Installation

Using NPM:

npm i --save @malgogi-rx-straw/core

Using YARN:

yarn add @malgogi-rx-straw/core --save

Examples

cron

cron is wrapper function of moment, node-cron

cron('* * * * * *')
    .subscribe((utcTimeInMillis: number) => {
        console.log(`task was started at ${utcTimeInMillis}`);
        // do task
    })

circuitBreaker

interval(1000)
  .pipe(circuitBreaker<number, number>({
    failureThreshold: 30,
    execute: (source) => {
      // do business logic.
      return 1;
    },
    fallback: () => {
      // fail action.
      return 2;
    },
  }))
  .pipe(take(3))
  .subscribe({
    next(item) { console.log('You can get a 1 or 2') },
    complete() { done(); }
  });

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published