Skip to content

Commit e6c1b3b

Browse files
committed
Add comments of how conditional import works
1 parent d223974 commit e6c1b3b

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/app/providers/electron.service.ts

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

3+
// If you import a module but never use any of the imported values other than as TypeScript types,
4+
// the resulting javascript file will look as if you never imported the module at all.
35
import { ipcRenderer } from 'electron';
46
import * as childProcess from 'child_process';
57

@@ -10,6 +12,7 @@ export class ElectronService {
1012
childProcess: typeof childProcess;
1113

1214
constructor() {
15+
//Conditional imports
1316
if (this.isElectron()) {
1417
this.ipcRenderer = window.require('electron').ipcRenderer;
1518
this.childProcess = window.require('child_process');

0 commit comments

Comments
 (0)