mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
* Change notification when extension is not found - Removes legacy downloadFile and downloadJson in favour of using `node-fetch` - A notification will be displayed if the URL provided results in a status of 404 Signed-off-by: Sebastian Malton <sebastian@malton.name> * Resolve PR comments Signed-off-by: Sebastian Malton <sebastian@malton.name> Signed-off-by: Sebastian Malton <sebastian@malton.name>
18 lines
561 B
TypeScript
18 lines
561 B
TypeScript
/**
|
|
* Copyright (c) OpenLens Authors. All rights reserved.
|
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
|
*/
|
|
|
|
/**
|
|
* Creates an AbortController with an associated timeout
|
|
* @param timeout The number of milliseconds before this controller will auto abort
|
|
*/
|
|
export function withTimeout(timeout: number): AbortController {
|
|
const controller = new AbortController();
|
|
const id = setTimeout(() => controller.abort(), timeout);
|
|
|
|
controller.signal.addEventListener("abort", () => clearTimeout(id));
|
|
|
|
return controller;
|
|
}
|