Call promise infinitely useful for Infinite Loading.
Definitely(new Promise(function(resolve, reject) {
reject("Hello!");
}), 500, function() {}, function(logs) {
console.log(logs);
});<script src="https://cdn.jsdelivr.net/gh/dlvdls18/Definitely@main/src/definitely.js"></script>Call the function Definitely with these order of arguments:
NOTE: Every arguments are required.
Definitely(promise, times, onsuccess, onerror, delay);PromiseClass<Promise> - Promise to call.TimesNumber - Error limit when the promise rejected.OnsuccessFunction - When the promise resolved, this will called with the resolve arguments.OnerrorFunction - When the expected loop is done, this will called with argumentError Arraywhich has every error logs.DelayNumber - Loop delay
When the promise resolved, the loop will end.
