-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
54 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,54 @@ | ||
# NetworkProvider | ||
Ionic 3 Provider that detects the network change in application and notifies the user with an alert. | ||
# Network Provider | ||
|
||
Network Provider is an Ionic3-based provider that detects the network change in application and notifies the user with an alert. | ||
|
||
- Import the provider in app.module and app.component | ||
- Call the .networkDetect() function in app.component constructor | ||
- See the magic! | ||
|
||
--- | ||
### Installation | ||
|
||
*app.module.ts* | ||
|
||
```ts | ||
import { Network } from '@ionic-native/network'; | ||
import { NetworkProvider } from '../providers/network/network'; | ||
|
||
@NgModule({ | ||
... | ||
providers: [ | ||
... | ||
Network, | ||
NetworkProvider, | ||
], | ||
}) | ||
``` | ||
|
||
*app.component.ts* | ||
|
||
```ts | ||
import { NetworkProvider } from '../providers/network/network'; | ||
|
||
@Component({ | ||
templateUrl: "app.html" | ||
}) | ||
class MyApp { | ||
constructor(network: NetworkProvider) { | ||
... | ||
network.detectNetwork(); | ||
.... | ||
} | ||
... | ||
} | ||
``` | ||
|
||
### Todos | ||
|
||
- Add Network Detection on first run of the application | ||
- Add screenshots to README | ||
|
||
License | ||
---- | ||
|
||
MIT |