@capacitor-community/bluetooth-le
Version:
Capacitor plugin for Bluetooth Low Energy
18 lines • 533 B
JavaScript
const makeQueue = () => {
let currentTask = Promise.resolve();
// create a new promise so that errors can be bubbled
// up to the caller without being caught by the queue
return (fn) => new Promise((resolve, reject) => {
currentTask = currentTask
.then(() => fn())
.then(resolve)
.catch(reject);
});
};
export function getQueue(enabled) {
if (enabled) {
return makeQueue();
}
return (fn) => fn();
}
//# sourceMappingURL=queue.js.map