UNPKG

@exadel/esl

Version:

Exadel Smart Library (ESL) is the lightweight custom elements library that provide a set of super-flexible components

8 lines (7 loc) 407 B
/** * @returns Promise that will be resolved or rejected in `timeout` with an optional `payload` * If `isReject` is `true` the result promise will be rejected, otherwise (by default) the result promise will be resolved */ export function promisifyTimeout(timeout, payload, isReject) { return new Promise((resolve, reject) => setTimeout((isReject ? reject : resolve).bind(null, payload), timeout)); }