jrquick17 / ng-speed-test

A light weight Angular 2+ library for checking internet speed
https://ng-speed-test.jrquick.com
MIT License
12 stars 3 forks source link

ng-speed-test

npm npm npm

Index

About

A lightweight Angular 2+ service for checking internet speed

Setup

Install

npm install ng-speed-test --save

Import module

Functionality

Check Internet Speed

import {SpeedTestService} from 'ng-speed-test';

@Injectable()
export class TechCheckService {
  constructor(
    private speedTestService:SpeedTestService
  ) {
    this.speedTestService.getMbps().subscribe(
      (speed) => {
        console.log('Your speed is ' + speed);
      }
    );
  }
}

Check Internet Speed w/ Custom Settings

import {SpeedTestService} from 'ng-speed-test';

@Injectable()
export class TechCheckService {
  constructor(
    private speedTestService:SpeedTestService
  ) {
    this.speedTestService.getMbps(
      {
        iterations: 10,
        file: {
          path: 'my-custom-image.png',
          size: 2048
        },
        retryDelay: 1500,
      }
    ).subscribe(
      (speed) => {
        console.log('Your speed is ' + speed);
      }
    );
  }
}

Check If Online

import {SpeedTestService} from 'ng-speed-test';

@Injectable()
export class TechCheckService {
  constructor(
    private speedTestService:SpeedTestService
  ) {
    this.speedTestService.isOnline().subscribe(
      (isOnline) => {
        if (isOnline === false) {
          console.log('Network unavailable.');
        }
      }
    );
  }
}

Functions

Settings

File Settings

Contributing

Thanks

Issues

If you find any issues feel free to open a request in the Issues tab. If I have the time I will try to solve any issues but cannot make any guarantees. Feel free to contribute yourself.

Release

Demo

Generate Docs

Update Version

Build

Test

NPM Release

Update Changelog