Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed May 30, 2024
1 parent 6070862 commit 8e4b229
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,9 @@ import { merge, setUndefinedIfNotDeclared } from "../utils";
import { notyf } from "../../../dependencies.js";
import { homeDirectory, testDataFolderPath } from "../../../globals.js";

import {
SERVER_FILE_PATH,
electron,
path,
port,
fs,
} from "../../../../utils/electron.js";

import {
onUpdateAvailable,
onUpdateProgress,
} from "../../../../utils/auto-update.js";
import { SERVER_FILE_PATH, electron, path, port, fs } from "../../../../utils/electron.js";

import { onUpdateAvailable, onUpdateProgress } from "../../../../utils/auto-update.js";

import saveSVG from "../../../../assets/icons/save.svg?raw";
import folderSVG from "../../../../assets/icons/folder_open.svg?raw";
Expand Down
50 changes: 25 additions & 25 deletions src/electron/frontend/utils/auto-update.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
let updateAvailable = false;
const updateAvailableCallbacks = [];
export const onUpdateAvailable = (callback) => {
if (updateAvailable) callback(updateAvailable);
else updateAvailableCallbacks.push(callback);
};

let updateProgress = null;

const updateProgressCallbacks = [];
export const onUpdateProgress = (callback) => {
if (updateProgress) callback(updateProgress);
else updateProgressCallbacks.push(callback);
};

export const registerUpdateProgress = (info) => {
updateProgress = info;
updateProgressCallbacks.forEach((cb) => cb(info));
};

export const registerUpdate = (info) => {
updateAvailable = info;
document.body.setAttribute("data-update-available", JSON.stringify(info));
updateAvailableCallbacks.forEach((cb) => cb(info));
};
let updateAvailable = false;
const updateAvailableCallbacks = [];
export const onUpdateAvailable = (callback) => {
if (updateAvailable) callback(updateAvailable);
else updateAvailableCallbacks.push(callback);
};

let updateProgress = null;

const updateProgressCallbacks = [];
export const onUpdateProgress = (callback) => {
if (updateProgress) callback(updateProgress);
else updateProgressCallbacks.push(callback);
};

export const registerUpdateProgress = (info) => {
updateProgress = info;
updateProgressCallbacks.forEach((cb) => cb(info));
};

export const registerUpdate = (info) => {
updateAvailable = info;
document.body.setAttribute("data-update-available", JSON.stringify(info));
updateAvailableCallbacks.forEach((cb) => cb(info));
};

0 comments on commit 8e4b229

Please sign in to comment.