feat: migration to TypeScript FINAL

Co-authored-by: Su-Yong <simssy2205@gmail.com>
This commit is contained in:
JellyBrick
2023-09-04 02:27:53 +09:00
parent c0d7972da3
commit 53f5bda382
72 changed files with 1290 additions and 693 deletions

View File

@ -0,0 +1,39 @@
import path from 'node:path';
import { BrowserWindow } from 'electron';
import { ACTIONS, CHANNEL } from './actions';
import { injectCSS, listenAction } from '../utils';
export function handle(win: BrowserWindow) {
injectCSS(win.webContents, path.join(__dirname, 'style.css'), () => {
win.webContents.send('navigation-css-ready');
});
listenAction(CHANNEL, (_, action) => {
switch (action) {
case ACTIONS.NEXT: {
if (win.webContents.canGoForward()) {
win.webContents.goForward();
}
break;
}
case ACTIONS.BACK: {
if (win.webContents.canGoBack()) {
win.webContents.goBack();
}
break;
}
default: {
console.log('Unknown action: ' + action);
}
}
});
}
export default handle;