Skip to content

Commit 8a4b624

Browse files
committed
ref/ replace electron.remote (deprecated) by @electron/remote
1 parent a26d5f1 commit 8a4b624

File tree

4 files changed

+17
-9
lines changed

4 files changed

+17
-9
lines changed

Diff for: main.ts

+3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ import { app, BrowserWindow, screen } from 'electron';
22
import * as path from 'path';
33
import * as url from 'url';
44

5+
// Initialize remote module
6+
require('@electron/remote/main').initialize();
7+
58
let win: BrowserWindow = null;
69
const args = process.argv.slice(1),
710
serve = args.some(val => val === '--serve');

Diff for: package-lock.json

+6-5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: package.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,9 @@
4040
"version": "conventional-changelog -i CHANGELOG.md -s -r 0 && git add CHANGELOG.md",
4141
"lint": "ng lint"
4242
},
43-
"dependencies": {},
43+
"dependencies": {
44+
"@electron/remote": "1.0.4"
45+
},
4446
"devDependencies": {
4547
"@angular-builders/custom-webpack": "11.0.0",
4648
"@angular-devkit/build-angular": "0.1102.0",

Diff for: src/app/core/services/electron/electron.service.ts

+5-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ import { Injectable } from '@angular/core';
22

33
// If you import a module but never use any of the imported values other than as TypeScript types,
44
// the resulting javascript file will look as if you never imported the module at all.
5-
import { ipcRenderer, webFrame, remote } from 'electron';
5+
import { ipcRenderer, webFrame } from 'electron';
6+
import * as remote from '@electron/remote';
67
import * as childProcess from 'child_process';
78
import * as fs from 'fs';
89

@@ -26,8 +27,9 @@ export class ElectronService {
2627
this.ipcRenderer = window.require('electron').ipcRenderer;
2728
this.webFrame = window.require('electron').webFrame;
2829

29-
// If you wan to use remote object, pleanse set enableRemoteModule to true in main.ts
30-
// this.remote = window.require('electron').remote;
30+
// If you want to use remote object in renderer process, please set enableRemoteModule to true in main.ts
31+
// this.remote = window.require('@electron/remote');
32+
// console.log('remote - globalShortcut', this.remote.globalShortcut);
3133

3234
this.childProcess = window.require('child_process');
3335
this.fs = window.require('fs');

0 commit comments

Comments
 (0)