Skip to content

Commit

Permalink
Add comments of how conditional import works
Browse files Browse the repository at this point in the history
  • Loading branch information
maximegris committed May 5, 2017
1 parent d223974 commit e6c1b3b
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/app/providers/electron.service.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { Injectable } from '@angular/core';

// 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.
import { ipcRenderer } from 'electron';
import * as childProcess from 'child_process';

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

constructor() {
//Conditional imports
if (this.isElectron()) {
this.ipcRenderer = window.require('electron').ipcRenderer;
this.childProcess = window.require('child_process');
Expand Down

0 comments on commit e6c1b3b

Please sign in to comment.