SetInterval - Chrome Extension

0

I'm having a little problem,

I need to make a simple alert to be displayed every 10 minutes for users, so I was asked to mount an extension for chrome since they use a dialer in chrome and it stays open all the time. The problem is as follows, I made the manifest.json already, I configured everything ok. I established background.js for scripts but then the problem starts. (The extension is installed and working properly, my problem is with setInterval which does not seem to work any longer)

I run the following function.

var registraCPF = setInterval(alert('Registrar CPF'), 60000);

But with the 60000 being 1 minute it does not work, the alert is not triggered. Now when I put the alert in 15000 or 3000 there.

var registraCPF = setInterval(alert('Registrar CPF'), 3000);

It works normally, does anyone know why?

    
asked by anonymous 04.12.2018 / 18:51

1 answer

0

Try to create a function to show alert() :

var registraCPF = setInterval(function() {
        alert('Registrar CPF')
    }, 60000);
    
04.12.2018 / 19:33