You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
session-desktop/ts/webworker/workers/util_worker_interface.ts

19 lines
771 B
TypeScript

import { WorkerInterface } from '../worker_interface';
import { join } from 'path';
import { ipcRenderer } from 'electron';
let utilWorkerInterface: WorkerInterface | undefined;
export const internalCallUtilsWorker = async (fnName: string, ...args: any): Promise<any> => {
if (!utilWorkerInterface) {
const apDataPath = await ipcRenderer.invoke('get-data-path');
const utilWorkerPath = join(apDataPath, 'ts', 'webworker', 'workers', 'util.worker.js');
utilWorkerInterface = new WorkerInterface(utilWorkerPath, 3 * 60 * 1000); //{ type: 'module' }
}
return utilWorkerInterface?.callWorker(fnName, ...args);
};
export const callUtilsWorker = async (fnName: string, ...args: any): Promise<any> => {
return internalCallUtilsWorker(fnName, ...args);
};