0

I need explanation and a solution to why the following code isnt working in in my Electron code.

const electron = require("electron");
const ipcRenderer = electron.ipcRenderer;

let seconds = 60;
module.exports = function countdown(){
        setInterval(function () {
            if(seconds == 0){
                seconds = 60;
            }
            seconds--
            console.log(seconds);
            ipcRenderer.send("ticking", seconds)
        },1000)
    }

All i am trying to do is just publish an event using the ipcRenderer.send() method every second, however i get an Uncaught Exception error shown bellow.

Cannot read property send of undefined at Timeout_onTimeout

enter image description here

floormind
  • 1,868
  • 5
  • 31
  • 85

0 Answers0