aboutsummaryrefslogtreecommitdiff
path: root/e2e-lanthan/eventually.js
diff options
context:
space:
mode:
Diffstat (limited to 'e2e-lanthan/eventually.js')
-rw-r--r--e2e-lanthan/eventually.js25
1 files changed, 0 insertions, 25 deletions
diff --git a/e2e-lanthan/eventually.js b/e2e-lanthan/eventually.js
deleted file mode 100644
index c04c277..0000000
--- a/e2e-lanthan/eventually.js
+++ /dev/null
@@ -1,25 +0,0 @@
-const assert = require('assert');
-
-let defaultInterval = 100;
-let defaultTimeout = 2000;
-
-function sleep(ms) {
- return new Promise(resolve => setTimeout(resolve, ms));
-}
-
-const eventually = async (fn, timeout = defaultTimeout, interval = defaultInterval) => {
- let start = Date.now();
- let loop = async() => {
- try {
- await fn();
- } catch (err) {
- if (Date.now() - start > timeout) {
- throw err;
- }
- await new Promise((resolve) => setTimeout(resolve, interval))
- await loop();
- }
- };
- await loop();
-};
-module.exports = eventually;