Update electron to 17.3.0

This commit is contained in:
Fedor Indutny 2022-03-29 10:06:42 -07:00 committed by GitHub
parent 8b36e37d18
commit f7c3a44056
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 15 additions and 87 deletions

View file

@ -3,6 +3,7 @@
import { join } from 'path';
import { Worker } from 'worker_threads';
import { app } from 'electron';
export type WrappedWorkerRequest = {
readonly uuid: string;
@ -15,25 +16,17 @@ export type WrappedWorkerResponse = {
readonly response?: File;
};
const ASAR_PATTERN = /app\.asar$/;
export function getHeicConverter(): (
uuid: string,
data: Uint8Array
) => Promise<WrappedWorkerResponse> {
let appDir = join(__dirname, '..', '..');
let isBundled = false;
if (ASAR_PATTERN.test(appDir)) {
appDir = appDir.replace(ASAR_PATTERN, 'app.asar.unpacked');
isBundled = true;
}
const scriptDir = join(appDir, 'ts', 'workers');
const worker = new Worker(
join(
scriptDir,
isBundled ? 'heicConverter.bundle.js' : 'heicConverterWorker.js'
)
const scriptDir = join(
app.getAppPath(),
'ts',
'workers',
'heicConverterWorker.js'
);
const worker = new Worker(scriptDir);
const ResponseMap = new Map<
string,