mirror of
https://github.com/streetwriters/notesnook.git
synced 2026-02-23 19:49:56 +01:00
web: register stream saver service worker on app start
This commit is contained in:
@@ -37,7 +37,6 @@ import { EVENTS } from "@notesnook/core/dist/common";
|
||||
import { getFormattedDate } from "@notesnook/common";
|
||||
import { createWritableStream } from "./desktop-bridge";
|
||||
import { ZipStream } from "../utils/streams/zip-stream";
|
||||
import { register } from "../utils/stream-saver/mitm";
|
||||
import { FeatureKeys } from "../dialogs/feature-dialog";
|
||||
import { Reader } from "../utils/zip-reader";
|
||||
|
||||
@@ -79,7 +78,6 @@ export async function introduceFeatures() {
|
||||
export const DEFAULT_CONTEXT = { colors: [], tags: [], notebook: {} };
|
||||
|
||||
export async function createBackup() {
|
||||
await register();
|
||||
const encryptBackups =
|
||||
userstore.get().isLoggedIn && Config.get("encryptBackups", false);
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@ import { logger } from "./utils/logger";
|
||||
import { loadDatabase } from "./hooks/use-database";
|
||||
import { AppEventManager, AppEvents } from "./common/app-events";
|
||||
import { BaseThemeProvider } from "./components/theme-provider";
|
||||
import { register } from "./utils/stream-saver/mitm";
|
||||
|
||||
renderApp();
|
||||
|
||||
@@ -50,6 +51,8 @@ async function renderApp() {
|
||||
const serviceWorkerWhitelist: Routes[] = ["default"];
|
||||
async function initializeServiceWorker() {
|
||||
if (!IS_DESKTOP_APP) {
|
||||
await register();
|
||||
|
||||
logger.info("Initializing service worker...");
|
||||
const serviceWorker = await import("./service-worker-registration");
|
||||
|
||||
|
||||
@@ -23,7 +23,6 @@ import BaseStore from "./index";
|
||||
import { store as editorStore } from "./editor-store";
|
||||
import { checkAttachment } from "../common/attachments";
|
||||
import { showToast } from "../utils/toast";
|
||||
import { register } from "../utils/stream-saver/mitm";
|
||||
import { AttachmentStream } from "../utils/streams/attachment-stream";
|
||||
import { ZipStream } from "../utils/streams/zip-stream";
|
||||
import { createWriteStream } from "../utils/stream-saver";
|
||||
@@ -57,7 +56,6 @@ class AttachmentStore extends BaseStore {
|
||||
(state) => (state.status = { current: 0, total: attachments.length })
|
||||
);
|
||||
|
||||
await register();
|
||||
abortController = new AbortController();
|
||||
const attachmentStream = new AttachmentStream(
|
||||
attachments,
|
||||
|
||||
@@ -46,6 +46,7 @@ function registerWorker() {
|
||||
);
|
||||
})
|
||||
.then((swReg) => {
|
||||
console.log("Stream saver service worker registered!");
|
||||
const swRegTmp = swReg.installing || swReg.waiting;
|
||||
|
||||
scope = swReg.scope;
|
||||
|
||||
Reference in New Issue
Block a user