How to get current electron window reference in angular component?

Viewed 282

I'm building and electron app (using Angular 8). In a specific component, i want make the current window (not creating new) transparent (setOpacity(0)). But i'm not able to get the current electron window reference in angular component.

I tried require('electron').remote.getCurrentWindow(). But this gave errors (path module cannot be resolved, fs module cannot be resolved).

I have installed path, fs, node types. And updated tsconfig

{
  "compileOnSave": false,
  "compilerOptions": {
    "allowSyntheticDefaultImports": true,
    "baseUrl": "./",
    "outDir": "./dist/out-tsc",
    "sourceMap": true,
    "declaration": false,
    // "module": "esnext",
    "module": "es2015",
    "moduleResolution": "node",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "importHelpers": true,
    "target": "es5",
    "typeRoots": ["node_modules/@types"],
    "types": ["node"],
    "lib": ["es2018", "dom"],
    "strict": false
  }
  // "angularCompilerOptions": {
  //   "fullTemplateTypeCheck": true,
  //   "strictInjectionParameters": true
  // }
}

And tried this (https://gist.github.com/niespodd/1fa82da6f8c901d1c33d2fcbb762947d)

Now i'm getting this error

ERROR Error: Uncaught (in promise): TypeError: path.join is not a function
TypeError: path.join is not a function
    at Object.<anonymous> (index.js:4)
    at Object../node_modules/electron/index.js (index.js:18)

Is there a way to get hold of the current window (not creating new one)?

0 Answers
Related