zhangxiaoshuangx / ngx-online-status

πŸ”› Angular 5+ Detect online/offline state

Home Page:https://vadimdez.github.io/ngx-online-status/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ngx-online-status

Detect online/offline state

Angular Module to track online and offline state

Demo

https://vadimdez.github.io/ngx-online-status/

Install

npm install ngx-online-status --save

Usage

  • Import OnlineStatusModule to your module
@NgModule({
  declarations: [
    // ...
  ],
  imports: [
    OnlineStatusModule
  ],
  providers: [
    //...
  ]
})
  • Inject OnlineStatusService and use it:
//...

export class AppComponent {
  status: OnlineStatusType;

  constructor(private onlineStatusService: OnlineStatusService) {
    this.onlineStatusService.status.subscribe((status: OnlineStatusType) => {
      // use status
      this.status = status;
    });
  }
}

License

MIT Β© Vadym Yatsyuk

About

πŸ”› Angular 5+ Detect online/offline state

https://vadimdez.github.io/ngx-online-status/

License:MIT License


Languages

Language:TypeScript 74.7%Language:JavaScript 12.8%Language:HTML 10.2%Language:CSS 2.3%