Files
appium/test/helpers/repeat.js
2014-02-07 12:51:20 +08:00

12 lines
225 B
JavaScript

"use strict";
var tryNTimes = function (n, fn) {
if (n <= 0) return;
return fn().catch(function () {
return tryNTimes(n - 1, fn);
});
};
exports.tryNTimes = tryNTimes;
exports.try3Times = tryNTimes.bind(null, 3);