# Progress Service

A simple abstraction over Toastr and Nanobar to centralize vizualization of "in progress actions".
Automatically tracks and vizualizes router navigation events, and exposes the ability to easy track other async operations.

Ex:
```typescript
import ProgressService from "@fancyawesome/progres-service";
import { autoinject } from "aurelia-framework";

@autoinject
export class MyPage {
  constructor(private readonly progressService: ProgressService) { }
}

public async myAsyncThing() {
  const status = this.progressService.start();
  try {
    const result = await someLongOperation();
    if (result.isErr()) {
      status.cancel("Failed to do the first thing.");
    }

    status.increment();

    await someOtherLongOperation();

    status.ok("Did the thing!");
  } catch (e) {
    status.error(e);
  }
}

```


Based on: https://github.com/alexjoverm/typescript-library-starter

### NPM scripts

 - `npm t`: Run test suite
 - `npm run test:watch`: Run test suite in [interactive watch mode](http://facebook.github.io/jest/docs/cli.html#watch)
 - `npm run test:prod`: Run linting + generate coverage
 - `npm run dev`: Run a server at `localhost:8081` (default) for quick development
 - `npm run build`: Bundles code, create docs and generate typings
 - `npm run build:dev`: Same than `build`, but code is not minified
 - `npm run commit`: Commit using conventional commit style ([husky](https://github.com/typicode/husky) will tell you to use it if you haven't :wink:)

To commit, you must use `npm run commit`, which is a convenient way to create conventional commits.
