![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/ts.corals.io/frontend/node_modules/pusher-js/spec/javascripts/helpers/ |
let interval = 50; /** * waitsFor backports the [email protected] waitsFor feature to keep old tests working * * @deprecated You shouldn't use this for writing new tests * * @param {Function} condition * @param {string} reason * @param {number} timeout * @returns */ module.exports = async (condition, reason, timeout) => { if (typeof condition !== 'function') { throw new Error('Condition is not a function'); } if (typeof reason !== 'string') { throw new Error('Reason is not a string'); } if (typeof timeout !== 'number') { throw new Error('Timeout is not a number'); } while (timeout >= 0) { if (condition()) { return; } await new Promise(r => setTimeout(r, interval)); timeout -= interval; } throw new Error(`waitsFor on "${reason}" timed out`); };