mirror of
https://github.com/remotely-save/remotely-save.git
synced 2024-06-07 21:10:45 +00:00
remove dep on delay lib
This commit is contained in:
parent
cfe316f690
commit
83e0073134
@ -72,7 +72,6 @@
|
||||
"aws-crt": "^1.20.0",
|
||||
"buffer": "^6.0.3",
|
||||
"crypto-browserify": "^3.12.0",
|
||||
"delay": "^6.0.0",
|
||||
"dropbox": "^10.34.0",
|
||||
"emoji-regex": "^10.3.0",
|
||||
"http-status-codes": "^2.3.0",
|
||||
|
10
src/misc.ts
10
src/misc.ts
@ -513,6 +513,14 @@ export const stringToFragment = (string: string) => {
|
||||
return wrapper.content;
|
||||
};
|
||||
|
||||
/**
|
||||
* https://stackoverflow.com/questions/39538473/using-settimeout-on-promise-chain
|
||||
* @param ms
|
||||
* @returns
|
||||
*/
|
||||
export const delay = (ms: number) =>
|
||||
new Promise((resolve) => setTimeout(resolve, ms));
|
||||
|
||||
/**
|
||||
* https://forum.obsidian.md/t/css-to-show-status-bar-on-mobile-devices/77185
|
||||
* @param op
|
||||
@ -550,7 +558,7 @@ export const changeMobileStatusBar = (
|
||||
k.className.contains("mobile-toolbar")
|
||||
) {
|
||||
// have to wait, otherwise the height is not correct??
|
||||
await new Promise((resolve) => setTimeout(resolve, 300));
|
||||
await delay(300);
|
||||
const height = window
|
||||
.getComputedStyle(k as Element)
|
||||
.getPropertyValue("height");
|
||||
|
@ -1,4 +1,3 @@
|
||||
import { rangeDelay } from "delay";
|
||||
import { Dropbox, DropboxAuth } from "dropbox";
|
||||
import type { files, DropboxResponseError, DropboxResponse } from "dropbox";
|
||||
import { Vault } from "obsidian";
|
||||
@ -12,6 +11,7 @@ import {
|
||||
} from "./baseTypes";
|
||||
import {
|
||||
bufferToArrayBuffer,
|
||||
delay,
|
||||
fixEntityListCasesInplace,
|
||||
getFolderLevels,
|
||||
hasEmojiInText,
|
||||
@ -19,6 +19,7 @@ import {
|
||||
mkdirpInVault,
|
||||
} from "./misc";
|
||||
import { Cipher } from "./encryptUnified";
|
||||
import { random } from "lodash";
|
||||
|
||||
export { Dropbox } from "dropbox";
|
||||
|
||||
@ -292,7 +293,7 @@ async function retryReq<T>(
|
||||
2
|
||||
)}`
|
||||
);
|
||||
await rangeDelay(secMin * 1000, secMax * 1000);
|
||||
await delay(random(secMin * 1000, secMax * 1000));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user