LoRaWAN-Signal-Mapping/client_src/js/Helpers/PromiseUnwind.mjs

17 lines
462 B
JavaScript

"use strict";
/**
* Unwinds a recursive promise.
* @param {Promise} promise The recursive promise to unwind.
* @param {Function} callback_step A function to exexcute at each step of the unwinding process
*/
async function promise_unwind(promise) {
let current_promise = promise;
while(current_promise !== null) {
// Unwind this Promise and obtain it's return value
current_promise = await current_promise;
}
}
export default promise_unwind;