Skip to main content

Overview

Provides WiFi status information and methods to control WiFi functionality. Returns an object with WiFi state and control methods.
const useWifi: () => {
  wifiEnabled: boolean | undefined;
  wifiConnected: boolean | undefined;
  networkConnected: boolean | undefined;
  enableWifi: () => void;
  disableWifi: () => void;
  openWifiSettings: () => void;
}

Usage

import { useWifi } from 'node-fullykiosk';

function WiFiControl() {
  const { 
    wifiEnabled, 
    wifiConnected, 
    networkConnected,
    enableWifi, 
    disableWifi, 
    openWifiSettings 
  } = useWifi();

  return (
    <div>
      <h2>WiFi Status</h2>
      <p>WiFi Enabled: {wifiEnabled ? 'Yes' : 'No'}</p>
      <p>WiFi Connected: {wifiConnected ? 'Yes' : 'No'}</p>
      <p>Network Connected: {networkConnected ? 'Yes' : 'No'}</p>
      
      <button onClick={enableWifi}>Enable WiFi</button>
      <button onClick={disableWifi}>Disable WiFi</button>
      <button onClick={openWifiSettings}>Open WiFi Settings</button>
    </div>
  );
}

Return Value

wifiEnabled
boolean | undefined
Whether WiFi is enabled on the device. Returns undefined if Fully Kiosk Browser is not available.
wifiConnected
boolean | undefined
Whether the device is connected to a WiFi network. Returns undefined if Fully Kiosk Browser is not available.
networkConnected
boolean | undefined
Whether the device has an active network connection. Returns undefined if Fully Kiosk Browser is not available.
enableWifi
() => void
Method to enable WiFi on the device.
disableWifi
() => void
Method to disable WiFi on the device.
openWifiSettings
() => void
Method to open the system WiFi settings screen.

Events

This hook automatically registers event listeners for network state changes:
  • networkReconnect - Triggered when network reconnects
  • networkDisconnect - Triggered when network disconnects

Build docs developers (and LLMs) love