@stoprocent/noble 2.3.3 → 2.3.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/noble.js +1 -0
- package/lib/win/src/winrt_cpp.cc +8 -1
- package/package.json +1 -1
- package/prebuilds/darwin-x64+arm64/@stoprocent+noble.node +0 -0
- package/prebuilds/win32-ia32/@stoprocent+noble.node +0 -0
- package/prebuilds/win32-x64/@stoprocent+noble.node +0 -0
- package/test/noble.test.js +13 -0
package/lib/noble.js
CHANGED
package/lib/win/src/winrt_cpp.cc
CHANGED
|
@@ -44,7 +44,14 @@ std::string toStr(winrt::guid uuid)
|
|
|
44
44
|
{
|
|
45
45
|
auto i = ref.Value();
|
|
46
46
|
std::ostringstream ret;
|
|
47
|
-
|
|
47
|
+
// Ensure proper width for short IDs to preserve leading zeros
|
|
48
|
+
if (i <= 0xFFFF) {
|
|
49
|
+
ret << std::hex << std::setfill('0') << std::setw(4) << i;
|
|
50
|
+
} else if (i <= 0xFFFFFFFF) {
|
|
51
|
+
ret << std::hex << std::setfill('0') << std::setw(8) << i;
|
|
52
|
+
} else {
|
|
53
|
+
ret << std::hex << i;
|
|
54
|
+
}
|
|
48
55
|
return ret.str();
|
|
49
56
|
}
|
|
50
57
|
}
|
package/package.json
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/test/noble.test.js
CHANGED
|
@@ -420,6 +420,19 @@ describe('noble', () => {
|
|
|
420
420
|
// Promise should reject after timeout
|
|
421
421
|
await expect(promise).rejects.toThrow('Timeout waiting for Noble to be powered on');
|
|
422
422
|
});
|
|
423
|
+
|
|
424
|
+
test('should not cause MaxListenersExceededWarning with multiple timeout calls', async () => {
|
|
425
|
+
noble._state = 'poweredOff';
|
|
426
|
+
|
|
427
|
+
const promises = [];
|
|
428
|
+
for (let i = 0; i < 11; i++) {
|
|
429
|
+
promises.push(noble.waitForPoweredOnAsync(0).catch(() => {}));
|
|
430
|
+
}
|
|
431
|
+
await Promise.all(promises);
|
|
432
|
+
const finalListenerCount = noble.listenerCount('stateChange');
|
|
433
|
+
|
|
434
|
+
expect(finalListenerCount).toBeLessThanOrEqual(1);
|
|
435
|
+
});
|
|
423
436
|
});
|
|
424
437
|
|
|
425
438
|
test('should change address', () => {
|