Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

angular-async-tracker

mattlewis92153MIT2.0.0TypeScript support: included

A port of angular-promise-tracker to angular 6+ that also supports observables

angular2, angular, angular6, async-tracker, promises, observables, async

readme

angular async tracker

Build Status codecov npm version devDependency Status GitHub issues GitHub stars GitHub license

Table of contents

About

A port of angular-promise-tracker to angular 6+ that also supports observables

Installation

Install through npm:

npm install --save angular-async-tracker

Finally use in one of your apps components:

import { Component } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { Subscription } from 'rxjs';
import { take } from 'rxjs/operators';
import { AsyncTrackerFactory, AsyncTracker } from 'angular-async-tracker';

@Component({
  template: `
    <span *ngIf="asyncTracker.active">Loading...</span>
    <button *ngIf="!asyncTracker.active" (click)="save()">Save</button>
  `
})
export class MyComponent {
  asyncTracker: AsyncTracker;

  constructor(
    private http: HttpClient,
    asyncTrackerFactory: AsyncTrackerFactory
  ) {
    this.asyncTracker = asyncTrackerFactory.create();
  }

  save() {
    const saved: Subscription = this.http
      .post('/foo', { bar: 'bam' })
      .pipe(take(1))
      .subscribe(result => {
        console.log(result);
      });
    // `asyncTracker.add` accepts promises or observable subscriptions
    this.asyncTracker.add(saved);
  }
}

Documentation

All documentation is auto-generated from the source via compodoc and can be viewed here: https://mattlewis92.github.io/angular-async-tracker/docs/

Development

Prepare your environment

  • Install Node.js and NPM (should come with)
  • Install local dev dependencies: npm while current directory is this repo

Development server

Run npm start to start a development server on port 8000 with auto reload + tests.

Testing

Run npm test to run tests once or npm run test:watch to continually run tests.

Release

npm run release

License

MIT

changelog

Change Log

All notable changes to this project will be documented in this file. See standard-version for commit guidelines.

2.0.0 (2018-05-14)

Features

BREAKING CHANGES

  • angular 6 or higher is now required to use this module. Also the AsyncTrackerModule has been removed. To migrate, just remove it from your code.

1.0.2 (2018-05-05)

Bug Fixes

  • allow angular 6 peer dependency (90c9acc)

1.0.1 (2017-11-02)

Bug Fixes

  • add support for angular 5 (9a1ab84)

1.0.0 (2017-04-16)

Features