Test complete
Tested logging from both worker (in web app) and when running in Electron. Refs: - https://github.com/GoogleChromeLabs/comlink/issues/506 - https://github.com/GoogleChromeLabs/comlink/issues/568
This commit is contained in:
parent
da9a704094
commit
84d21984e0
5 changed files with 5 additions and 10 deletions
|
@ -47,7 +47,7 @@ export default function DebugSection() {
|
|||
|
||||
const downloadDebugLogs = () => {
|
||||
addLogLine("exporting logs");
|
||||
if (false && isElectron()) {
|
||||
if (isElectron()) {
|
||||
ElectronAPIs.openLogDirectory();
|
||||
} else {
|
||||
const logs = getDebugLogs();
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
import { logError } from "@ente/shared/sentry";
|
||||
import * as Comlink from "comlink";
|
||||
import HeicConvert from "heic-convert";
|
||||
import { getUint8ArrayView } from "services/readerService";
|
||||
|
@ -17,8 +16,6 @@ Comlink.expose(DedicatedConvertWorker, self);
|
|||
* Both the input and output are blobs.
|
||||
*/
|
||||
export const convertHEICToJPEG = async (heicBlob: Blob): Promise<Blob> => {
|
||||
// throw new Error("test error");
|
||||
logError(new Error("test error"), "test message");
|
||||
const filedata = await getUint8ArrayView(heicBlob);
|
||||
const result = await HeicConvert({ buffer: filedata, format: "JPEG" });
|
||||
const convertedFileData = new Uint8Array(result);
|
||||
|
|
|
@ -18,7 +18,6 @@ export const logError = async (
|
|||
}
|
||||
${error?.stack}`);
|
||||
} else {
|
||||
console.log("here");
|
||||
addLogLine(
|
||||
`error: ${error?.name} ${error?.message}
|
||||
msg: ${msg} ${info ? `info: ${JSON.stringify(info)}` : ""}
|
||||
|
|
|
@ -32,8 +32,7 @@ export enum LS_KEYS {
|
|||
|
||||
export const setData = (key: LS_KEYS, value: object) => {
|
||||
if (typeof localStorage === "undefined") {
|
||||
console.log("early return");
|
||||
// return null;
|
||||
return null;
|
||||
}
|
||||
localStorage.setItem(key, JSON.stringify(value));
|
||||
};
|
||||
|
|
|
@ -21,7 +21,7 @@ export class ComlinkWorker<T extends new () => InstanceType<T>> {
|
|||
addLocalLog(() => `Initiated ${this.name}`);
|
||||
const comlink = wrap<T>(this.worker);
|
||||
this.remote = new comlink() as Promise<Remote<InstanceType<T>>>;
|
||||
expose(workerBridge, this.worker);
|
||||
expose(workerBridge, worker);
|
||||
}
|
||||
|
||||
public getName() {
|
||||
|
@ -38,8 +38,8 @@ export class ComlinkWorker<T extends new () => InstanceType<T>> {
|
|||
* A minimal set of utility functions that we expose to all workers that we
|
||||
* create.
|
||||
*
|
||||
* Inside the worker's code, this can be accessed by
|
||||
* `wrap<WorkerBridge>(self).foo`.
|
||||
* Inside the worker's code, this can be accessed by using the sibling
|
||||
* `workerBridge` object by importing `worker-bridge.ts`.
|
||||
*/
|
||||
const workerBridge = {
|
||||
logToDisk,
|
||||
|
|
Loading…
Reference in a new issue