UNPKG

maz-ui

Version:

A standalone components library for Vue.Js 3 & Nuxt.Js 3

17 lines (16 loc) 594 B
function l(r, o, s) { const e = { maxAttempts: 20, interval: 100, ...s }; let t = 0; function a() { const i = r(); i != null ? e.expectedValue !== void 0 && i !== e.expectedValue ? t < e.maxAttempts ? (t++, setTimeout(a, e.interval)) : e.onError?.(new Error(e.errorMessage || `[maz-ui](checkAvailability) Nothing found after ${e.maxAttempts} attempts`)) : o(i) : t < e.maxAttempts ? (t++, setTimeout(a, e.interval)) : e.onError?.(new Error(e.errorMessage || `[maz-ui](checkAvailability) Nothing found after ${e.maxAttempts} attempts`)); } a(); } export { l };