Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
this.init(() => {
this.deviceHandles = {};
function stateCB() {
if (this.state === true) {
// Noble doesn't correctly match short and canonical UUIDs on Linux, so we need to check ourselves
// Continually scan to pick up all advertised UUIDs
noble.startScanning([], true, this.checkForError(errorFn, completeFn));
} else {
errorFn("adapter not enabled");
}
}
if (noble.state === "unknown" || noble.state === "poweredOff") {
// tslint:disable-next-line:no-string-literal
noble["once"]("stateChange", stateCB.bind(this));
} else {
stateCB.call(this);
}
});
}
public getEnabled(completeFn: (enabled: boolean) => void) {
function stateCB() {
completeFn(this.state);
}
if (noble.state === "unknown" || noble.state === "poweredOff") {
// tslint:disable-next-line:no-string-literal
noble["once"]("stateChange", stateCB.bind(this));
} else {
stateCB.call(this);
}
}