From 04a849dd15d7640fbeba4b718e1723e19267835d Mon Sep 17 00:00:00 2001 From: Kacper Cyranowski Date: Mon, 17 Jun 2024 15:33:09 +0200 Subject: [PATCH] fix: ci/cd --- example/src/services/BLEService/BLEService.ts | 2 +- src/BleManager.js | 18 ++++++++---------- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/example/src/services/BLEService/BLEService.ts b/example/src/services/BLEService/BLEService.ts index 78e80dad..8b6e2a13 100644 --- a/example/src/services/BLEService/BLEService.ts +++ b/example/src/services/BLEService/BLEService.ts @@ -112,7 +112,7 @@ class BLEServiceInstance { onDeviceFound(device) } }) - .then(() => console.log('scanning')) + .then(() => {}) .catch(console.error) } diff --git a/src/BleManager.js b/src/BleManager.js index c16166bf..c107722b 100644 --- a/src/BleManager.js +++ b/src/BleManager.js @@ -5,7 +5,7 @@ import { Device } from './Device' import { Service } from './Service' import { Characteristic } from './Characteristic' import { Descriptor } from './Descriptor' -import { State, LogLevel, type BleErrorCodeMessageMapping, ConnectionPriority } from './TypeDefinition' +import { State, LogLevel, ConnectionPriority } from './TypeDefinition' import { BleModule, EventEmitter } from './BleModule' import { parseBleError, @@ -18,6 +18,7 @@ import { } from './BleError' import type { NativeDevice, NativeCharacteristic, NativeDescriptor, NativeBleRestoredState } from './BleModule' import type { + BleErrorCodeMessageMapping, Subscription, DeviceId, Identifier, @@ -135,7 +136,7 @@ export class BleManager { * @returns {Promise} Promise may return an error when the function cannot be called. * {@link #bleerrorcodebluetoothmanagerdestroyed|BluetoothManagerDestroyed} error code. */ - destroy = async (): Promise => { + async destroy(): Promise { const response = await this._callPromise(BleModule.destroyClient()) // Unsubscribe from any subscriptions @@ -229,7 +230,7 @@ export class BleManager { * @param {TransactionId} transactionId Id of pending transactions. * @returns {Promise} */ - cancelTransaction(transactionId: TransactionId) { + cancelTransaction(transactionId: TransactionId): Promise { return this._callPromise(BleModule.cancelTransaction(transactionId)) } @@ -271,7 +272,7 @@ export class BleManager { * * @returns {Promise} Promise which emits current state of BleManager. */ - state = (): Promise<$Keys> => { + state(): Promise<$Keys> { return this._callPromise(BleModule.state()) } @@ -292,10 +293,7 @@ export class BleManager { * * @returns {Subscription} Subscription on which `remove()` function can be called to unsubscribe. */ - onStateChange = ( - listener: (newState: $Keys) => void, - emitCurrentState: boolean = false - ): Subscription => { + onStateChange(listener: (newState: $Keys) => void, emitCurrentState: boolean = false): Subscription { const subscription: Subscription = this._eventEmitter.addListener(BleModule.StateChangeEvent, listener) const id = this._nextUniqueID() var wrappedSubscription: Subscription @@ -352,7 +350,7 @@ export class BleManager { UUIDs: ?Array, options: ?ScanOptions, listener: (error: ?BleError, scannedDevice: ?Device) => Promise - ) { + ): Promise { const scanListener = ([error, nativeDevice]: [?string, ?NativeDevice]) => { listener( error ? parseBleError(error, this._errorCodesToMessagesMapping) : null, @@ -369,7 +367,7 @@ export class BleManager { * Stops {@link Device} scan if in progress. * @returns {Promise} the promise may be rejected if the operation is impossible to perform. */ - stopDeviceScan = async (): Promise => { + stopDeviceScan(): Promise { if (this._scanEventSubscription != null) { this._scanEventSubscription.remove() this._scanEventSubscription = null