foliveira/bbeight-discovery

View on GitHub
index.js

Summary

Maintainability
A
0 mins
Test Coverage
const noble = require('noble')

module.exports = (callback) => {
  noble.on('stateChange', (state) => {
    if (state === 'poweredOn') {
      noble.startScanning()
    } else {
      noble.stopScanning()
    }
  })

  noble.on('discover', callback)
}