UNPKG
@ermitsrl/bluetooth-le
Version:
latest (2.4.8)
2.4.8
2.4.7
2.4.6
2.4.5
2.4.4
2.4.2
2.4.1
2.4.0
2.3.16
2.3.15
2.3.14
2.3.13
2.3.12
2.3.11
2.3.10
2.3.9
2.3.8
2.3.7
2.3.6
2.3.5
2.3.4
2.3.3
2.3.2
2.3.1
2.3.0
2.2.3
2.2.2
2.2.1
2.2.0
2.1.2
2.1.1
Capacitor plugin for Bluetooth Low Energy
@ermitsrl/bluetooth-le
/
dist
/
esm
/
timeout.js
10 lines
•
315 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
9
10
export
async
function
runWithTimeout
(
promise, time, exception
) {
let
timer;
return
Promise
.
race
([ promise,
new
Promise
(
(
_, reject
) =>
{ timer =
setTimeout
(
() =>
reject
(exception), time); }), ]).
finally
(
() =>
clearTimeout
(timer)); }
//# sourceMappingURL=timeout.js.map