Network status and monitoring.
$ npm install universal-network --save
Gets the current network state.
Property | Type | Description | Support |
---|---|---|---|
networkType | String |
Network type | |
networkAvailable | Boolean |
Availability of network |
Start listening for changes in network status.
Property | Type | Description | Support |
---|---|---|---|
isConnected | Boolean |
Availability of network | |
networkType | String |
Network type |
Cancels all event monitoring if the parameter is empty.
Property | Type | Default | Required | Description | Support |
---|---|---|---|---|---|
callback | Function |
x | Callback function for network state change events |
import Network from 'universal-network';
Network.getType().then(res => {
console.log(res.networkType);
});
Network.onStatusChange((res) => {
console.log('on: ', res.networkType)
});
setTimeout(() => {
Network.offStatusChange();
}, 1000);