aboutsummaryrefslogtreecommitdiffstats
path: root/src/electron-util.ts
diff options
context:
space:
mode:
authorLibravatar Markus Hatvan <markus_hatvan@aon.at>2021-10-14 13:24:58 +0200
committerLibravatar GitHub <noreply@github.com>2021-10-14 13:24:58 +0200
commitfe1ba2ad6affeb6c0e97c73171d8fa3f31dde73e (patch)
tree10caa332d957421e982c7ddd0c94623d5d62314d /src/electron-util.ts
parentchore: convert various JS to TS (#2062) (diff)
downloadferdium-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.ts21
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
3import electron from 'electron'; 3import * as electron from 'electron';
4import { initialize } from '@electron/remote/main'; 4import { initialize } from '@electron/remote/main';
5 5
6export const initializeRemote = () => { 6export 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
14export const remote = new Proxy({}, { 16export 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
22export const api = new Proxy(electron, { 27export const api = new Proxy(electron, {
23 get: (target, property) => { 28 get: (target, property) => {