ref/ replace electron.remote (deprecated) by @electron/remote
This commit is contained in:
3
main.ts
3
main.ts
@@ -2,6 +2,9 @@ import { app, BrowserWindow, screen } from 'electron';
|
|||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
import * as url from 'url';
|
import * as url from 'url';
|
||||||
|
|
||||||
|
// Initialize remote module
|
||||||
|
require('@electron/remote/main').initialize();
|
||||||
|
|
||||||
let win: BrowserWindow = null;
|
let win: BrowserWindow = null;
|
||||||
const args = process.argv.slice(1),
|
const args = process.argv.slice(1),
|
||||||
serve = args.some(val => val === '--serve');
|
serve = args.some(val => val === '--serve');
|
||||||
|
|||||||
11
package-lock.json
generated
11
package-lock.json
generated
@@ -1629,6 +1629,12 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"@electron/remote": {
|
||||||
|
"version": "1.0.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/@electron/remote/-/remote-1.0.4.tgz",
|
||||||
|
"integrity": "sha512-kguDJRhL3ZynHrkbX8Tr7xoAzGsNgh4eqXkycXb6cgXbOgehGqkBVe+MnjSVMXz3QJykerGKPy28gqcM7AFGYw==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"@eslint/eslintrc": {
|
"@eslint/eslintrc": {
|
||||||
"version": "0.3.0",
|
"version": "0.3.0",
|
||||||
"resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-0.3.0.tgz",
|
"resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-0.3.0.tgz",
|
||||||
@@ -6819,11 +6825,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"electron-log": {
|
|
||||||
"version": "4.3.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/electron-log/-/electron-log-4.3.1.tgz",
|
|
||||||
"integrity": "sha512-S/0CMjYjgyWUsZ3d27VvErPaI5W4oILp4jfeCuN4DhDqrJW6jKRUD2PxFfTdeZEIjM7+fttGg7A61rPcAcZC1w=="
|
|
||||||
},
|
|
||||||
"electron-publish": {
|
"electron-publish": {
|
||||||
"version": "22.9.1",
|
"version": "22.9.1",
|
||||||
"resolved": "https://registry.npmjs.org/electron-publish/-/electron-publish-22.9.1.tgz",
|
"resolved": "https://registry.npmjs.org/electron-publish/-/electron-publish-22.9.1.tgz",
|
||||||
|
|||||||
@@ -40,7 +40,9 @@
|
|||||||
"version": "conventional-changelog -i CHANGELOG.md -s -r 0 && git add CHANGELOG.md",
|
"version": "conventional-changelog -i CHANGELOG.md -s -r 0 && git add CHANGELOG.md",
|
||||||
"lint": "ng lint"
|
"lint": "ng lint"
|
||||||
},
|
},
|
||||||
"dependencies": {},
|
"dependencies": {
|
||||||
|
"@electron/remote": "1.0.4"
|
||||||
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@angular-builders/custom-webpack": "11.0.0",
|
"@angular-builders/custom-webpack": "11.0.0",
|
||||||
"@angular-devkit/build-angular": "0.1102.0",
|
"@angular-devkit/build-angular": "0.1102.0",
|
||||||
|
|||||||
@@ -2,7 +2,8 @@ import { Injectable } from '@angular/core';
|
|||||||
|
|
||||||
// If you import a module but never use any of the imported values other than as TypeScript types,
|
// If you import a module but never use any of the imported values other than as TypeScript types,
|
||||||
// the resulting javascript file will look as if you never imported the module at all.
|
// the resulting javascript file will look as if you never imported the module at all.
|
||||||
import { ipcRenderer, webFrame, remote } from 'electron';
|
import { ipcRenderer, webFrame } from 'electron';
|
||||||
|
import * as remote from '@electron/remote';
|
||||||
import * as childProcess from 'child_process';
|
import * as childProcess from 'child_process';
|
||||||
import * as fs from 'fs';
|
import * as fs from 'fs';
|
||||||
|
|
||||||
@@ -26,8 +27,9 @@ export class ElectronService {
|
|||||||
this.ipcRenderer = window.require('electron').ipcRenderer;
|
this.ipcRenderer = window.require('electron').ipcRenderer;
|
||||||
this.webFrame = window.require('electron').webFrame;
|
this.webFrame = window.require('electron').webFrame;
|
||||||
|
|
||||||
// If you wan to use remote object, pleanse set enableRemoteModule to true in main.ts
|
// If you want to use remote object in renderer process, please set enableRemoteModule to true in main.ts
|
||||||
// this.remote = window.require('electron').remote;
|
// this.remote = window.require('@electron/remote');
|
||||||
|
// console.log('remote - globalShortcut', this.remote.globalShortcut);
|
||||||
|
|
||||||
this.childProcess = window.require('child_process');
|
this.childProcess = window.require('child_process');
|
||||||
this.fs = window.require('fs');
|
this.fs = window.require('fs');
|
||||||
|
|||||||
Reference in New Issue
Block a user