ngx-ready-set-go
TypeScript icon, indicating that this package has built-in type declarations

0.1.0 • Public • Published

ngx-ready-set-go

This library will help you indicate (track) the progress of you requests. When they are preparing, executing or if there is an error.

Its purpose is to be attached to any observable by providing IndicatorBehavioralSubject to it.

How to install

Add it to you project by executing the following:

npm i ngx-ready-set-go --save

Use it in action

TS

 
indicatorIndicatorBehaviorSubject = new IndicatorBehaviorSubject();
 
this.readySetGoService.getUsersFromAPI()
.pipe(indicate(this.indicator))
.subscribe((res: any) => {
  console.log(res);
});
 

HTML

 
<div *ngIf="indicator | async as status">
   <span>Loading: {{status.loading}}</span>
   <span>Error: {{status.error}}</span>
   <span>Loaded: {{status.loaded}}</span>
</div>
 

States

It has 3 states for now: error: false, loaded: false, loading: false

They are all false on init.

  • On prepare: loading becomes true, all others false
  • On catchError: error becomes true, all others false
  • On finalize: loaded becomes true, all others false

Furture updates

I would be happy to get your feedback and suggestions

Package Sidebar

Install

npm i ngx-ready-set-go

Weekly Downloads

5

Version

0.1.0

License

BSD-2-Clause

Unpacked Size

101 kB

Total Files

21

Last publish

Collaborators

  • webfactory