ElectronJS中的程序任务

ipakzgxi  于 8个月前  发布在  Electron
关注(0)|答案(1)|浏览(99)

我编辑了我的问题和代码以使其更简单。我需要这两个函数每x次自动执行:

ipcMain.handle('get', () => {
   getProducts()
   getDatarticulo()
});

字符串
我已经尝试了setInterval,但它不工作,它不会再次运行,你知道为什么吗?谢谢。

ipcMain.handle('get', () => {
   getProducts()
   getDatarticulo()
   setInterval('getProducts()',1000)
   setInterval('getDatarticulo()',1000)
});


它给了我这个错误
“get”的处理程序出错:TypeError [ERR_INVALID_CALLBACK]:回调必须是函数。已接收“getProducts()”

kpbwa7wx

kpbwa7wx1#

setInterval(()=>{
  getProducts();
},1000);

字符串
试试用这个

相关问题