mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Fully split apart the weblinks storage
Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
1 parent
ae32375beb
commit
037c62d426
30 files changed
+448
-253
No files matched your search
@@ -22,3 +22,11 @@ export function setTimeoutFor(controller: AbortController, timeout: number): voi
|
||||
|
||||
controller.signal.addEventListener("abort", () => clearTimeout(handle));
|
||||
}
|
||||
|
||||
export function chainSignal(target: AbortController, signal: AbortSignal) {
|
||||
if (signal.aborted) {
|
||||
target.abort();
|
||||
} else {
|
||||
signal.addEventListener("abort", (event) => target.abort(event));
|
||||
}
|
||||
}
|
||||
@@ -10,11 +10,11 @@
|
||||
* @param timeout The number of milliseconds before resolving
|
||||
* @param failFast An abort controller instance to cause the delay to short-circuit
|
||||
*/
|
||||
export function delay(timeout = 1000, failFast?: AbortController): Promise<void> {
|
||||
export function delay(timeout = 1000, failFast?: AbortSignal): Promise<void> {
|
||||
return new Promise(resolve => {
|
||||
const timeoutId = setTimeout(resolve, timeout);
|
||||
|
||||
failFast?.signal.addEventListener("abort", () => {
|
||||
failFast?.addEventListener("abort", () => {
|
||||
clearTimeout(timeoutId);
|
||||
resolve();
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user