我目前有以下代码。该功能应该自动保存用户在屏幕上输入的文本 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