Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

468
Vistas
Electron/Angular : How to use typescript component functions/variables in main.js

I am new to angular , electron.

I am trying to use type script component functions/variables in main.js.

I have LicesneController component which holds emailId, I want to call some methods at the time of tool closure which required emailId(stored in loginCompoenent).

I tried several ways to achieve this :

  1. Local and session storage: Not worked as they cannot be used at client side. : giving error as localStorage is not defined
  2. Include LicesneController module in main.js const { LicenseController } = require('./src/lib/LicenseController'); : giving Exception as Cann't find module

Question is :

  • why #2 is not working any reason (all the paths are correct) ?
  • Is there any other way to achieve this scenario ?
  • If we are using node local storage , how we can hold values set in ts file and use in js file for node local storage.
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

I have resolved this scenario by using win.webContents.send and ipc renderer.

I was trying to call typescript methods from main.js

in main.js:

    win.webContents.send('On Close');

in typeScript : app.component.ts :

ipcr: IpcRenderer;


  ngOnInit() {
    this.ipcr = window.ipcRenderer;
    this.ipcr.on('On Close', (event, arg) => {
      // Do Some stuff here
    });
  }
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda