UNPKG

ziplayer

Version:

A modular Discord voice player with plugin system

14 lines 577 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.withTimeout = withTimeout; /** * Utility function to add timeout to a promise * @param promise The promise to add timeout to * @param timeoutMs Timeout in milliseconds * @param message Error message when timeout occurs * @returns Promise that rejects if timeout is reached */ function withTimeout(promise, timeoutMs, message) { return Promise.race([promise, new Promise((_, reject) => setTimeout(() => reject(new Error(message)), timeoutMs))]); } //# sourceMappingURL=timeout.js.map