Checks for an active network connection. If none found, adds an icon to the UI to indicate the status to the end user.
Can also be used to check the current download speed.
Name | Type | Attributes | Description | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options | object | <optional> | Object of configuration options. Properties
|
const options = {
iconWrapper: 'top-right-wrapper',
interval: 30000,
message: 'Internet connection is currently down.',
render: true,
uri: 'https://questions.learnosity.com?latest-lts',
}
LT.init(itemsApp, {
extensions: [
{ id: 'networkStatus', args: options },
],
});
Methods
checkConnection() → {promise}
Checks for network connectivity using a HEAD request. The return promise resolves to true if the request is successful, false otherwise.
- Since
- 2.12.0
- Returns:
- promise
checkSpeed() → {string}
Checks the current download speed using the Network Information API. Returns the current download speed in Mbps or a message indicating that the API is not supported. Eg 10 Mbps
.
- Since
- 2.25.0
- Returns:
- string