chore: cleanup

This commit is contained in:
2023-11-01 00:40:12 +09:00
parent 8f90daa840
commit c65bb7a992
56 changed files with 344 additions and 221 deletions

View File

@ -215,3 +215,15 @@ export function normalizeReaction(content: string) {
return Reaction.Positive;
}
}
export class OfflineError extends Error {}
export function throwIfOffline() {
if (isOffline()) {
throw new OfflineError("Offline");
}
}
export function isOffline() {
return !("navigator" in globalThis && globalThis.navigator.onLine);
}