timer
Functions
Function
Description
Example
Description
Usage Examples
Sleep/Delay
// Async delay
await dphelper.timer.sleep(1000);
// Pauses for 1 second
// In async functions
async function delayedAction() {
console.log('Start');
await dphelper.timer.sleep(2000);
console.log('After 2 seconds');
}
// Retry with delay
async function retryWithBackoff(fn, maxRetries = 3) {
for (let i = 0; i < maxRetries; i++) {
try {
return await fn();
} catch (err) {
if (i < maxRetries - 1) {
await dphelper.timer.sleep(1000 * Math.pow(2, i));
}
}
}
}Time Percentage
Progress Tracking
Details
Last updated