migrate to esm structure
This commit is contained in:
@@ -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 };
|
||||
Reference in New Issue
Block a user