migrate to esm structure

This commit is contained in:
TheBeastLT
2023-10-31 14:21:04 +02:00
parent c7fa8e9c50
commit 86cf502725
30 changed files with 242 additions and 311 deletions

View File

@@ -1,14 +1,14 @@
/**
* Delay promise
*/
async function delay(duration) {
export async function delay(duration) {
return new Promise((resolve) => setTimeout(resolve, duration));
}
/**
* Timeout promise after a set time in ms
*/
async function timeout(timeoutMs, promise, message = 'Timed out') {
export async function timeout(timeoutMs, promise, message = 'Timed out') {
return Promise.race([
promise,
new Promise(function (resolve, reject) {
@@ -18,5 +18,3 @@ async function timeout(timeoutMs, promise, message = 'Timed out') {
})
]);
}
module.exports = { delay, timeout };