Advertisement
Guest User

Untitled

a guest
Jun 19th, 2019
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. class PendingService {
  2. active = 0;
  3. isActive = false;
  4.  
  5. start() {
  6. this.active++;
  7. this.isActive = true;
  8. }
  9.  
  10. stop() {
  11. this.active--;
  12.  
  13. if (this.active === 0) {
  14. this.isActive = false;
  15. }
  16. }
  17. }
  18.  
  19. pendingService.start();
  20. data.get().subscribe(null, null, () => pendingService.stop());
  21.  
  22. <spinner [hidden]="!pendingService.isActive"></spinner>
  23.  
  24. <spinner [hidden]="pendingService.pending | async"></spinner>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement