Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

472
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda