Skip to content

Commit e3ad12d

Browse files
author
Maxime GRIS
committed
ref/ add node/electron module import as exemple : fs and remote
1 parent 54a3d6c commit e3ad12d

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/app/providers/electron.service.ts

+9-3
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,28 @@ 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 } from 'electron';
5+
import { ipcRenderer, webFrame, remote } from 'electron';
66
import * as childProcess from 'child_process';
7+
import * as fs from 'fs';
78

89
@Injectable()
910
export class ElectronService {
1011

1112
ipcRenderer: typeof ipcRenderer;
12-
childProcess: typeof childProcess;
1313
webFrame: typeof webFrame;
14+
remote: typeof remote;
15+
childProcess: typeof childProcess;
16+
fs: typeof fs;
1417

1518
constructor() {
1619
// Conditional imports
1720
if (this.isElectron()) {
1821
this.ipcRenderer = window.require('electron').ipcRenderer;
19-
this.childProcess = window.require('child_process');
2022
this.webFrame = window.require('electron').webFrame;
23+
this.remote = window.require('electron').remote;
24+
25+
this.childProcess = window.require('child_process');
26+
this.fs = window.require('fs');
2127
}
2228
}
2329

0 commit comments

Comments
 (0)