UNPKG

@prelude/function

Version:

Function module.

18 lines 461 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const timeout = (wait, f, g) => new Promise((resolve, reject) => { const id = setTimeout(() => { try { resolve(g()); } catch (err) { reject(err); } }, wait); f() .finally(() => clearTimeout(id)) .then(resolve) .catch(reject); }); exports.default = timeout; //# sourceMappingURL=timeout.js.map