]> BookStack Code Mirror - bookstack/blobdiff - resources/js/services/util.js
Drawio: Started browser drawing backup store system
[bookstack] / resources / js / services / util.js
index dd97d81aaf47113b301660794eda9b881d54e1e8..0a8966f15c638031e3a4c4685ebe8e6b2be93b47 100644 (file)
@@ -70,3 +70,14 @@ export function uniqueId() {
     const S4 = () => (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1);
     return (`${S4() + S4()}-${S4()}-${S4()}-${S4()}-${S4()}${S4()}${S4()}`);
 }
+
+/**
+ * Create a promise that resolves after the given time.
+ * @param {int} timeMs
+ * @returns {Promise}
+ */
+export function wait(timeMs) {
+    return new Promise(res => {
+        setTimeout(res, timeMs);
+    });
+}