parent
b1dcbc3454
commit
121ecb328a
|
@ -2,6 +2,8 @@ import { SpacePrimitives } from "./space_primitives.ts";
|
|||
import { FileMeta } from "../../plug-api/types.ts";
|
||||
import { flushCachesAndUnregisterServiceWorker } from "../sw_util.ts";
|
||||
|
||||
const fetchTimeout = 5000;
|
||||
|
||||
export class HttpSpacePrimitives implements SpacePrimitives {
|
||||
constructor(
|
||||
readonly url: string,
|
||||
|
@ -29,6 +31,7 @@ export class HttpSpacePrimitives implements SpacePrimitives {
|
|||
}
|
||||
|
||||
try {
|
||||
options.signal = AbortSignal.timeout(fetchTimeout);
|
||||
const result = await fetch(url, options);
|
||||
if (result.status === 503) {
|
||||
throw new Error("Offline");
|
||||
|
|
Loading…
Reference in New Issue