ssb-mobile-bluetooth-manager
Advanced tools
Comparing version 3.1.2 to 3.2.0
15
index.js
@@ -8,2 +8,3 @@ const net = require('net'); | ||
const pullJson = require('pull-json-doubleline'); | ||
const pullDefer = require('pull-defer'); | ||
@@ -18,2 +19,6 @@ const zip = require('pull-zip') | ||
const delayedDeviceScanSource = pullDefer.source(); | ||
let scanActive = false; | ||
function makeManager (opts) { | ||
@@ -448,2 +453,3 @@ | ||
function nearbyScuttlebuttDevices(refreshInterval) { | ||
return pull( | ||
@@ -468,3 +474,5 @@ nearbyDevices(refreshInterval), | ||
return pull( | ||
pull.infinite(), | ||
// We don't start scanning until the user has made their own device discoverable, signalling they wish | ||
// to use the bluetooth functionality. | ||
delayedDeviceScanSource, | ||
pull.asyncMap((next, cb) => { | ||
@@ -497,2 +505,7 @@ | ||
if (!scanActive) { | ||
delayedDeviceScanSource.resolve(pull.infinite()); | ||
scanActive = true; | ||
} | ||
if (err) { | ||
@@ -499,0 +512,0 @@ cb(new Error(err.description), null); |
{ | ||
"name": "ssb-mobile-bluetooth-manager", | ||
"version": "3.1.2", | ||
"version": "3.2.0", | ||
"description": "A module for managing bluetooth connections over a react native bridge.", | ||
@@ -17,2 +17,3 @@ "main": "index.js", | ||
"debug": "^4.1.1", | ||
"pull-defer": "^0.2.3", | ||
"pull-json-doubleline": "^2.0.0", | ||
@@ -19,0 +20,0 @@ "pull-pushable": "^2.2.0", |
22021
531
8
+ Addedpull-defer@^0.2.3
+ Addedpull-defer@0.2.3(transitive)