[JS] Losing work / edits due to crashes? [TIP] | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 8

[JS] Losing work / edits due to crashes? [TIP]

SL can spontaneously reset* if you leave rogue timers. You should clear them ALL when visitors leave: function frame(timestamp) { ... } var myTO = setTimeout(frame, 17); var myIV = setInterval(frame, 17); var myAF = requestAnimationFrame(frame); // Fires when leaving [Output] window.onbeforeunload = function() { clearTimeout(myTO); clearInterval(myIV); cancelAnimationFrame(myAF); } * A completely sane response.

13th Jul 2017, 11:24 PM
Kirk Schafer
Kirk Schafer - avatar
1 Answer
0
its ok
16th Jul 2017, 8:51 PM
Azharuddin Ansari
Azharuddin Ansari - avatar