From: Nicolas Coden Date: Fri, 18 May 2018 20:16:27 +0000 (+0200) Subject: docs: add doc for "tryInterval" test utility X-Git-Tag: v6.6.0~3^2~178^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=33d009a48;p=thirdparty%2Ffoundation%2Ffoundation-sites.git docs: add doc for "tryInterval" test utility --- diff --git a/test/javascript/lib/utils.js b/test/javascript/lib/utils.js index 0f269834a..cb0e5aa2e 100644 --- a/test/javascript/lib/utils.js +++ b/test/javascript/lib/utils.js @@ -1,5 +1,14 @@ (function (global, $) { + /** + * Try to catch the `do` function every `interval` delay, until it succedes + * (does not throw an error) or a given `timout` time passed. + * If a `then` function is passed, it is called after `do` succeded. + * If a `catch` function is passed, it is called after each time `do` fails. + * + * @param {object} opts + * @param {object} opts + */ global.tryInterval = function (opts) { var _opts = $.extend({}, opts); var totalTime = 0;