diff options
author | Markus Hatvan <markus_hatvan@aon.at> | 2021-10-14 13:24:58 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-14 13:24:58 +0200 |
commit | fe1ba2ad6affeb6c0e97c73171d8fa3f31dde73e (patch) | |
tree | 10caa332d957421e982c7ddd0c94623d5d62314d /src/electron-util.ts | |
parent | chore: convert various JS to TS (#2062) (diff) | |
download | ferdium-app-fe1ba2ad6affeb6c0e97c73171d8fa3f31dde73e.tar.gz ferdium-app-fe1ba2ad6affeb6c0e97c73171d8fa3f31dde73e.tar.zst ferdium-app-fe1ba2ad6affeb6c0e97c73171d8fa3f31dde73e.zip |
chore: convert files to TS (#2066)
Diffstat (limited to 'src/electron-util.ts')
-rw-r--r-- | src/electron-util.ts | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/src/electron-util.ts b/src/electron-util.ts index f4b26cb10..3c395ab10 100644 --- a/src/electron-util.ts +++ b/src/electron-util.ts | |||
@@ -1,23 +1,28 @@ | |||
1 | // Enhanced from: https://github.com/dertieran/electron-util/blob/replace-remote/source/api.js | 1 | // Enhanced from: https://github.com/dertieran/electron-util/blob/replace-remote/source/api.js |
2 | 2 | ||
3 | import electron from 'electron'; | 3 | import * as electron from 'electron'; |
4 | import { initialize } from '@electron/remote/main'; | 4 | import { initialize } from '@electron/remote/main'; |
5 | 5 | ||
6 | export const initializeRemote = () => { | 6 | export const initializeRemote = () => { |
7 | if (process.type !== 'browser') { | 7 | if (process.type !== 'browser') { |
8 | throw new Error('The remote api must be initialized from the main process.'); | 8 | throw new Error( |
9 | 'The remote api must be initialized from the main process.', | ||
10 | ); | ||
9 | } | 11 | } |
10 | 12 | ||
11 | initialize(); | 13 | initialize(); |
12 | }; | 14 | }; |
13 | 15 | ||
14 | export const remote = new Proxy({}, { | 16 | export const remote = new Proxy( |
15 | get: (_target, property) => { | 17 | {}, |
16 | // eslint-disable-next-line global-require | 18 | { |
17 | const remote = require('@electron/remote'); | 19 | get: (_target, property) => { |
18 | return remote[property]; | 20 | // eslint-disable-next-line global-require |
21 | const remote = require('@electron/remote'); | ||
22 | return remote[property]; | ||
23 | }, | ||
19 | }, | 24 | }, |
20 | }); | 25 | ); |
21 | 26 | ||
22 | export const api = new Proxy(electron, { | 27 | export const api = new Proxy(electron, { |
23 | get: (target, property) => { | 28 | get: (target, property) => { |