Simple OfflineOnline widget built for version 4.x of the ArcGIS API for Javascript
- No required properties. Independent on
MapView
andSceneView
- Check if user has network connetion
- Customizable how to check online
- Polling URL (https://ipv4.icanhazip.com) - [default]
- Navigator.onLine
- Change style using CSS
Name | Type | Summary |
---|---|---|
offlineLabel | String | Offline label. |
onlineLabel | String | Online label. |
hideWhenOnline | Boolean | Hide Online label if online. |
viewModel | OfflineOnlineViewModel | The view model for this widget. |
useNavigatorOnline* | Boolean | Use browser navigator.onLine. [false] |
pollingUrl* | String | Polling url (https://ipv4.icanhazip.com) |
pollingInterval* | Number | Polling Interval (ms). |
pollingTimeout* | Number | Polling Timeout (ms). |
pollingResponseType* | String | Polling Response Type ["text"]. |
pollingHeaders* | String | Polling Headers [{}]. |
* = aliased
Name | Type | Summary |
---|---|---|
onlineStatus | Boolean | Current Online Status |
useNavigatorOnline | Boolean | Use browser navigator.onLine. [false] |
pollingUrl | String | Polling url (https://ipv4.icanhazip.com) |
pollingInterval | Number | Polling Interval (ms). |
pollingTimeout | Number | Polling Timeout (ms). |
pollingResponseType | String | Polling Response Type ["text"]. |
pollingHeaders | String | Polling Headers [{}]. |
const Offlineonline = new OfflineOnlineWidget({});
view.ui.add(Offlineonline, "top-right);
const Offlineonline = new OfflineOnlineWidget({
hideOnline: false,
onlineLabel: "Connected",
pollingUrl: "example.com/ping",
pollingResponseType: "json"
});
view.ui.add(Offlineonline, "top-right);