remove dep on delay lib
This commit is contained in:
parent
cfe316f690
commit
83e0073134
|
@ -72,7 +72,6 @@
|
||||||
"aws-crt": "^1.20.0",
|
"aws-crt": "^1.20.0",
|
||||||
"buffer": "^6.0.3",
|
"buffer": "^6.0.3",
|
||||||
"crypto-browserify": "^3.12.0",
|
"crypto-browserify": "^3.12.0",
|
||||||
"delay": "^6.0.0",
|
|
||||||
"dropbox": "^10.34.0",
|
"dropbox": "^10.34.0",
|
||||||
"emoji-regex": "^10.3.0",
|
"emoji-regex": "^10.3.0",
|
||||||
"http-status-codes": "^2.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;
|
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
|
* https://forum.obsidian.md/t/css-to-show-status-bar-on-mobile-devices/77185
|
||||||
* @param op
|
* @param op
|
||||||
|
@ -550,7 +558,7 @@ export const changeMobileStatusBar = (
|
||||||
k.className.contains("mobile-toolbar")
|
k.className.contains("mobile-toolbar")
|
||||||
) {
|
) {
|
||||||
// have to wait, otherwise the height is not correct??
|
// have to wait, otherwise the height is not correct??
|
||||||
await new Promise((resolve) => setTimeout(resolve, 300));
|
await delay(300);
|
||||||
const height = window
|
const height = window
|
||||||
.getComputedStyle(k as Element)
|
.getComputedStyle(k as Element)
|
||||||
.getPropertyValue("height");
|
.getPropertyValue("height");
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
import { rangeDelay } from "delay";
|
|
||||||
import { Dropbox, DropboxAuth } from "dropbox";
|
import { Dropbox, DropboxAuth } from "dropbox";
|
||||||
import type { files, DropboxResponseError, DropboxResponse } from "dropbox";
|
import type { files, DropboxResponseError, DropboxResponse } from "dropbox";
|
||||||
import { Vault } from "obsidian";
|
import { Vault } from "obsidian";
|
||||||
|
@ -12,6 +11,7 @@ import {
|
||||||
} from "./baseTypes";
|
} from "./baseTypes";
|
||||||
import {
|
import {
|
||||||
bufferToArrayBuffer,
|
bufferToArrayBuffer,
|
||||||
|
delay,
|
||||||
fixEntityListCasesInplace,
|
fixEntityListCasesInplace,
|
||||||
getFolderLevels,
|
getFolderLevels,
|
||||||
hasEmojiInText,
|
hasEmojiInText,
|
||||||
|
@ -19,6 +19,7 @@ import {
|
||||||
mkdirpInVault,
|
mkdirpInVault,
|
||||||
} from "./misc";
|
} from "./misc";
|
||||||
import { Cipher } from "./encryptUnified";
|
import { Cipher } from "./encryptUnified";
|
||||||
|
import { random } from "lodash";
|
||||||
|
|
||||||
export { Dropbox } from "dropbox";
|
export { Dropbox } from "dropbox";
|
||||||
|
|
||||||
|
@ -292,7 +293,7 @@ async function retryReq<T>(
|
||||||
2
|
2
|
||||||
)}`
|
)}`
|
||||||
);
|
);
|
||||||
await rangeDelay(secMin * 1000, secMax * 1000);
|
await delay(random(secMin * 1000, secMax * 1000));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue