mirror of
https://github.com/antebudimir/feishin.git
synced 2026-01-02 02:43:33 +00:00
Lint all files
This commit is contained in:
parent
22af76b4d6
commit
30e52ebb54
334 changed files with 76519 additions and 75932 deletions
|
|
@ -6,47 +6,47 @@ import { URL } from 'url';
|
|||
export let resolveHtmlPath: (htmlFileName: string) => string;
|
||||
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
const port = process.env.PORT || 4343;
|
||||
resolveHtmlPath = (htmlFileName: string) => {
|
||||
const url = new URL(`http://localhost:${port}`);
|
||||
url.pathname = htmlFileName;
|
||||
return url.href;
|
||||
};
|
||||
const port = process.env.PORT || 4343;
|
||||
resolveHtmlPath = (htmlFileName: string) => {
|
||||
const url = new URL(`http://localhost:${port}`);
|
||||
url.pathname = htmlFileName;
|
||||
return url.href;
|
||||
};
|
||||
} else {
|
||||
resolveHtmlPath = (htmlFileName: string) => {
|
||||
return `file://${path.resolve(__dirname, '../renderer/', htmlFileName)}`;
|
||||
};
|
||||
resolveHtmlPath = (htmlFileName: string) => {
|
||||
return `file://${path.resolve(__dirname, '../renderer/', htmlFileName)}`;
|
||||
};
|
||||
}
|
||||
|
||||
export const isMacOS = () => {
|
||||
return process.platform === 'darwin';
|
||||
return process.platform === 'darwin';
|
||||
};
|
||||
|
||||
export const isWindows = () => {
|
||||
return process.platform === 'win32';
|
||||
return process.platform === 'win32';
|
||||
};
|
||||
|
||||
export const isLinux = () => {
|
||||
return process.platform === 'linux';
|
||||
return process.platform === 'linux';
|
||||
};
|
||||
|
||||
export const hotkeyToElectronAccelerator = (hotkey: string) => {
|
||||
let accelerator = hotkey;
|
||||
let accelerator = hotkey;
|
||||
|
||||
const replacements = {
|
||||
mod: 'CmdOrCtrl',
|
||||
numpad: 'num',
|
||||
numpadadd: 'numadd',
|
||||
numpaddecimal: 'numdec',
|
||||
numpaddivide: 'numdiv',
|
||||
numpadenter: 'numenter',
|
||||
numpadmultiply: 'nummult',
|
||||
numpadsubtract: 'numsub',
|
||||
};
|
||||
const replacements = {
|
||||
mod: 'CmdOrCtrl',
|
||||
numpad: 'num',
|
||||
numpadadd: 'numadd',
|
||||
numpaddecimal: 'numdec',
|
||||
numpaddivide: 'numdiv',
|
||||
numpadenter: 'numenter',
|
||||
numpadmultiply: 'nummult',
|
||||
numpadsubtract: 'numsub',
|
||||
};
|
||||
|
||||
Object.keys(replacements).forEach((key) => {
|
||||
accelerator = accelerator.replace(key, replacements[key as keyof typeof replacements]);
|
||||
});
|
||||
Object.keys(replacements).forEach((key) => {
|
||||
accelerator = accelerator.replace(key, replacements[key as keyof typeof replacements]);
|
||||
});
|
||||
|
||||
return accelerator;
|
||||
return accelerator;
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue