Socket
Socket
Sign inDemoInstall

webbluetooth

Package Overview
Dependencies
22
Maintainers
1
Versions
58
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.3 to 1.0.4

17

lib/adapter.js

@@ -27,2 +27,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
const os_1 = require("os");
const events_1 = require("events");

@@ -45,2 +46,3 @@ const helpers_1 = require("./helpers");

this.enabled = false;
this.os = os_1.platform();
this.enabled = this.state;

@@ -64,3 +66,3 @@ noble.on("stateChange", () => {

}
checkForError(errorFn, continueFn) {
checkForError(errorFn, continueFn, delay) {
return function (error) {

@@ -71,3 +73,6 @@ if (error)

const args = [].slice.call(arguments, 1);
continueFn.apply(this, args);
if (delay === null)
continueFn.apply(this, args);
else
setTimeout(() => continueFn.apply(this, args), delay);
}

@@ -281,3 +286,9 @@ };

const buffer = this.dataViewToBuffer(value);
this.characteristicHandles[handle].write(buffer, true, this.checkForError(errorFn, completeFn));
const characteristic = this.characteristicHandles[handle];
// writeWithoutResponse and authenticatedSignedWrites don't require a response
const withoutResponse = characteristic.properties.indexOf("writeWithoutResponse") >= 0
|| characteristic.properties.indexOf("authenticatedSignedWrites") >= 0;
// Add a small delay for writing without response when not on MacOS
const delay = (this.os !== "darwin" && withoutResponse) ? 25 : null;
characteristic.write(buffer, withoutResponse, this.checkForError(errorFn, completeFn, delay));
}

@@ -284,0 +295,0 @@ enableNotify(handle, notifyFn, completeFn, errorFn) {

2

package.json
{
"name": "webbluetooth",
"version": "1.0.3",
"version": "1.0.4",
"description": "Node.js implementation of the Web Bluetooth Specification",

@@ -5,0 +5,0 @@ "homepage": "https://github.com/thegecko/webbluetooth",

@@ -26,2 +26,3 @@ /*

import { platform } from "os";
import { EventEmitter } from "events";

@@ -71,2 +72,3 @@ import { getCanonicalUUID } from "./helpers";

private enabled: boolean = false;
private os: string = platform();

@@ -95,3 +97,3 @@ constructor() {

private checkForError(errorFn, continueFn?) {
private checkForError(errorFn, continueFn?, delay?: number) {
return function(error) {

@@ -101,3 +103,4 @@ if (error) errorFn(error);

const args = [].slice.call(arguments, 1);
continueFn.apply(this, args);
if (delay === null) continueFn.apply(this, args);
else setTimeout(() => continueFn.apply(this, args), delay);
}

@@ -337,3 +340,12 @@ };

const buffer = this.dataViewToBuffer(value);
this.characteristicHandles[handle].write(buffer, true, this.checkForError(errorFn, completeFn));
const characteristic = this.characteristicHandles[handle];
// writeWithoutResponse and authenticatedSignedWrites don't require a response
const withoutResponse = characteristic.properties.indexOf("writeWithoutResponse") >= 0
|| characteristic.properties.indexOf("authenticatedSignedWrites") >= 0;
// Add a small delay for writing without response when not on MacOS
const delay = (this.os !== "darwin" && withoutResponse) ? 25 : null;
characteristic.write(buffer, withoutResponse, this.checkForError(errorFn, completeFn, delay));
}

@@ -340,0 +352,0 @@

@@ -40,6 +40,7 @@ /// <reference types="node" />

private enabled;
private os;
constructor();
private readonly state;
private init(completeFn);
private checkForError(errorFn, continueFn?);
private checkForError(errorFn, continueFn?, delay?);
private bufferToDataView(buffer);

@@ -46,0 +47,0 @@ private dataViewToBuffer(dataView);

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc