Skip to content

Commit

Permalink
feat: getEntryjsPath 함수 추가
Browse files Browse the repository at this point in the history
- 인공지능 손인식 블럭 대응
  • Loading branch information
Tnks2U committed Oct 30, 2023
1 parent 84e346c commit 6de6175
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/preload/preload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ ipcRenderer.on(
const { x, y, width, height } = dimension || {};
const imageElement = width && height ? new Image(width, height) : new Image();

imageElement.onload = function () {
imageElement.onload = function() {
canvas.width = imageElement.width;
canvas.height = imageElement.height;

Expand Down Expand Up @@ -66,7 +66,7 @@ window.ipcInvoke = (channel: string, ...args: any[]) => {

window.ipcSend = (channel: string, ...args: any[]) => {
ipcRenderer.send(channel, ...args);
}
};

window.openEntryWebPage = () => {
shell.openExternal('https://playentry.org/download/offline');
Expand All @@ -83,10 +83,16 @@ window.weightsPath = () => {
: path.resolve(remote.app.getAppPath(), 'node_modules', 'entry-js', 'weights');
};

window.getEntryjsPath = () => {
return process.env.NODE_ENV === 'production'
? path.resolve(process.resourcesPath, 'app.asar.unpacked', 'node_modules', 'entry-js')
: path.resolve(remote.app.getAppPath(), 'node_modules', 'entry-js');
};

window.getAppPathWithParams = (...params: string[]) => {
console.log(process.env.NODE_ENV);
return path.resolve(remote.app.getAppPath(), ...params);
}
};

/**
* external file => loadProjectFromMain event => loadProject => callback(project)
Expand Down
1 change: 1 addition & 0 deletions types/window.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ declare interface Preload {
openHardwarePage(): void;
checkPermission(type: 'microphone' | 'camera'): Promise<void>;
weightsPath: () => string;
getEntryjsPath: () => string;
getAppPathWithParams: (...params: string[]) => string;
}

Expand Down

0 comments on commit 6de6175

Please sign in to comment.