Behance Tiny-When
This Browser / Node.js library that periodically checks when a condition is satisfied.
Features
- Pass a condition to check the interval
- Set the options for interval of checks and the max number of checks
- Returns a promise that is resolved or rejected based on the options
Usage
const when = ; { return windowadobeAnalytics && windowliveFyre;} const options = maxChecks: 30 intervalInMs: 100 ;
When Arguments:
condition
- a function that checks to see if a condition is met (e.g.,function() { return window._satellite && window.s_adbadobenonacdc }
).options.intervalInMs
- defaults to300
- Number of MS before checking the conditionoptions.maxChecks
- defaults to30
- Number of Max checks