Back to packages list

Vals using delay

Description from the NPM package:
Delay a promise a specified amount of time
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import { monitored } from "https://esm.town/v/stevekrouse/sentry";
import delay from "npm:delay";
export default monitored(async function(interval: Interval) {
console.log(`Last run at ${interval.lastRunAt}`);
console.log("Starting 2s simulated job...");
await delay(2000);
console.log("Done");
// throw new Error("Any errors will be reported to Sentry");
}, {
schedule: {
type: "crontab",
value: "15 * * * *",
},
checkinMargin: 2,
maxRuntime: 10,
timezone: "UTC",
});
1
2
3
4
5
6
export const delayEx = (async () => {
const { default: delay } = await import("npm:delay");
console.log(performance.now());
await delay(1000);
console.log(performance.now());
})();
1
2
3
4
export let delay = async (ms = 300) => {
const { default: delay } = await import("npm:delay");
return delay(ms);
};
1
Next