hammerspoon2-docs
    Preparing search index...

    Function on

    • Register a listener for Bluetooth events.

      Listeners receive:

      • "connected", "disconnected": the HSBluetoothDevice that macOS connected or disconnected. For Hammerspoon's own connections to BLE peripherals, listen on the HSBluetoothPeripheral instead.
      • "powerChanged": true when Bluetooth is turned on, false when it's turned off
      • "discovered": each HSBluetoothPeripheral found while hs.bluetooth.scan() runs

      Parameters

      Returns void

      Throws an Error on failure; wrap calls in try/catch to handle it.