1.1.0 • Published 4 years ago

ngx-fi-online v1.1.0

Weekly downloads
4
License
MIT
Repository
github
Last release
4 years ago

NgxFiOnline

navigator.onLine wrapper

Installation

  • npm i ngx-fi-online --save

How to use

In a module

import { NgModule } from "@angular/core";
import { NgxFiOnlineModule } from "ngx-fi-online";

@NgModule({
  imports: [NgxFiOnlineModule], // for consumption within the scope of the module
  exports: [NgxFiOnlineModule] // if propagation is required
})
export class SomeModule {}

Where required

import { Inject } from "@angular/core";
import { OnlineDefinition, ONLINE_TOKEN } from "ngx-fi-online";

export class SomeClass {
  constructor(@Inject(ONLINE_TOKEN) private online: OnlineDefinition) {
    const isOnline = online.is();
  }
}

For testing

import { NgxFiOnlineModule } from "ngx-fi-online";
import { OnlineDefinition, ONLINE_TOKEN } from "ngx-fi-online";

describe('TestingTitle', () => {
  let online: OnlineDefinition;
  beforeEach(async(() => {
      TestBed.configureTestingModule({
        imports: [NgxFiOnlineModule]
      });

      online = TestBed.get(ONLINE_TOKEN);
    }));
  }));
}));
1.1.0

4 years ago

1.0.1

5 years ago

1.0.0

5 years ago

0.2.0

5 years ago

0.1.0

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago