{"id":15573027,"url":"https://github.com/saka7/ng-network-status","last_synced_at":"2025-04-24T02:22:14.509Z","repository":{"id":57310704,"uuid":"95191994","full_name":"Saka7/ng-network-status","owner":"Saka7","description":"Angular module for tracking \"network status change\" events","archived":false,"fork":false,"pushed_at":"2017-07-08T07:28:55.000Z","size":198,"stargazers_count":12,"open_issues_count":1,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-18T10:23:15.658Z","etag":null,"topics":["angular","angular4","network","offline-first","progressive-web-apps","pwa","rxjs"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/ng-network-status","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Saka7.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-06-23T06:52:54.000Z","updated_at":"2024-01-27T02:31:42.000Z","dependencies_parsed_at":"2022-08-26T04:50:58.913Z","dependency_job_id":null,"html_url":"https://github.com/Saka7/ng-network-status","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Saka7%2Fng-network-status","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Saka7%2Fng-network-status/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Saka7%2Fng-network-status/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Saka7%2Fng-network-status/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Saka7","download_url":"https://codeload.github.com/Saka7/ng-network-status/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250546375,"owners_count":21448318,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["angular","angular4","network","offline-first","progressive-web-apps","pwa","rxjs"],"created_at":"2024-10-02T18:10:00.705Z","updated_at":"2025-04-24T02:22:14.492Z","avatar_url":"https://github.com/Saka7.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"![ng-network-status](https://raw.githubusercontent.com/Saka7/ng-network-status/master/logo.png)\n\n# NG-NETWORK-STATUS\n[![Code Climate](https://codeclimate.com/github/Saka7/ng-network-status/badges/gpa.svg)](https://codeclimate.com/github/Saka7/ng-network-status)\n[![Issue Count](https://codeclimate.com/github/Saka7/ng-network-status/badges/issue_count.svg)](https://codeclimate.com/github/Saka7/ng-network-status)\n\n\n[![NPM](https://nodei.co/npm/ng-network-status.png)](https://nodei.co/npm/ng-network-status/)\n[![NPM](https://nodei.co/npm-dl/ng-network-status.png?months=6)](https://nodei.co/npm/ng-network-status/)\n\n\n**ng-network-status** will help you to add events when app is going online/offline.\n\n## Examples\n\n![ng-network-status-debian](https://j.gifs.com/j2oAoy.gif)\n\n-----\n\n\u003cimg src=\"https://j.gifs.com/JZvE0K.gif\" alt=\"ng-network-status-android\" width=\"380px\"/\u003e\n\n## Usage\n\n\u003e Take a look at the [example project](https://github.com/Saka7/ng-network-status/tree/master/examples/network-status-examples)\n\n### Install package\n\n`npm install --save ng-network-status`\n\n### Add NgNetworkStatusModule to your AppModule\n```javascript\nimport { BrowserModule } from '@angular/platform-browser';\nimport { NgModule } from '@angular/core';\n\nimport { NgNetworkStatusModule } from 'ng-network-status'; // \u003c-- HERE\n\nimport { AppComponent } from './app.component';\n\n@NgModule({\n  declarations: [\n    AppComponent\n  ],\n  imports: [\n    BrowserModule,\n    NgNetworkStatusModule // \u003c-- and HERE\n  ],\n  providers: [],\n  bootstrap: [AppComponent]\n})\nexport class AppModule { }\n```\n\n### Use NetworkStatusService in your components\n```javascript\nimport { Component, OnInit } from '@angular/core';\n\n// Import NetworkStatusService\nimport { NetworkStatusService } from 'ng-network-status';\n\n@Component({\n  selector: 'app-root',\n  templateUrl: './app.component.html',\n  styleUrls: ['./app.component.css'],\n  providers: [ NetworkStatusService ]\n})\nexport class AppComponent implements OnInit {\n\n  networkStatus = \"Online\";\n\n  // Inject NetworkStatusService instance\n  constructor(private networkStatusService: NetworkStatusService) {}\n\n  ngOnInit() {\n    // Register health check\n    this.networkStatusService.healthCheck();\n    // Subscribe on network status change event\n    this.networkStatusService.isOnline.subscribe(isOnline =\u003e {\n      this.networkStatus = isOnline ? \"Online\" : \"Offline\";\n    });\n  }\n\n}\n```\n\n### Available options\n`healthCheck` method signature\n```javascript\npublic healthCheck(interval: number, options: Options);\n```\n\nYou can configure interval and grayscale effect options.\n```javascript\nthis.networkStatusService.healthCheck(500, {\n  grayscale: {\n    enabled: false\n  }\n});\n```\n\n### Default option values\nDefault interval is `1000ms` and default options is\n```javascript\ndefaultOptions = {\n  grayscale: {\n    enabled: true,\n    animationDuration: 0.3,\n    percentage: 0.9\n  }\n};\n```\n\n## License\nng-network-status is released under the [MIT License](https://opensource.org/licenses/MIT).","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsaka7%2Fng-network-status","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsaka7%2Fng-network-status","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsaka7%2Fng-network-status/lists"}