Extensions/Assessment/networkStatus

Extensions add specific functionality to Items API. They rely on modules within LT being available.

--

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.

Methods

checkConnection() → {promise}

Checks for network connectivity using a HEAD request.

Since
2.12.0
Returns
  • Resolves to true if the request is successful, false otherwise.
Type
(promise)

checkSpeed() → {string}

Checks the current download speed using the Network Information API.

Since
2.25.0
Returns
  • The current download speed in Mbps or a message indicating that the API is not supported. Eg 10 Mbps.
Type
(string)

run(optionsopt)

Since
2.12.0
Example
import { LT } from '@caspingus/lt/src/assessment/core';
import * as networkStatus from '@caspingus/lt/src/assessment/extensions/ui/networkStatus/index';

LT.init(itemsApp); // Set up LT with the Items API application instance variable
networkStatus.run();
Parameters:
Name Type Attributes Description
options object <optional>

Optional configuration object includes:

  • iconWrapper (string) classname of element to inject the broken connection icon. You should never need this if using any of the Learnosity regions.
  • interval (numeric) millisecond interval to check connection. Defaults to 30000 (30 seconds).
  • message (string) message for tooltip and screen reader users.
  • render (boolean) whether to render the icon or not. Defaults to true.
  • uri (string) URI to check for network connectivity. Defaults to a Learnosity API endpoint which is already whitelisted.