功能自动保存时如何避免提前超时?

问题描述

我目前有以下代码。该功能应该自动保存用户在屏幕上输入的文本 7 分钟(420000 毫秒),而无需用户按下“提交”或“完成”按钮。我有两个这样的屏幕,让计数器在另一个屏幕中具有不同的值。

问题是,当我在服务器和 html 中运行它时,屏幕会在 7 分钟结束前自行超时。使用此代码的另一个屏幕也是如此。有谁知道为什么?功能有问题吗?有什么办法吗?

let counter = 8; //named differently in other screen

this.saveInterval = setInterval(() => {
  // Pull out the text field
  // Save the value into the collected data
  this.data["inputValue" + counter++] = document.getElementById("RPsun").value;

  // Submit the form automatically      
if (counter >= 8) {
  this.submit();
},420000);

this.saveInterval; // save

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)