Connection Status
import { isOnline } from '@bbc/front-end-kit/js/showpad/utils/connection-status';
A thin wrapper around the generic connection-status utility that pre-binds the ping target to https://showpad.biz. Use this instead of the generic util inside Showpad experiences to verify connectivity to the Showpad platform specifically.
Tips
navigator.onLine only checks for a network connection — not necessarily internet access. This util performs an actual HTTP ping to confirm reachability.
isOnline(...args)
Checks whether https://showpad.biz is reachable. All additional arguments are forwarded to the underlying isOnline from the generic util.
Returns
See isOnline in the generic util.
Example
import { isOnline } from '@bbc/front-end-kit/js/showpad/utils/connection-status';
const online = await isOnline();
if (!online) {
console.warn('Showpad platform is not reachable');
}
Related
For isOffline and getPingCache, import from the generic util directly:
import { isOffline, getPingCache } from '@bbc/front-end-kit/js/utils/connection-status';