You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I made a page using test-data/integration/step-with-events as a template to demo event pausing with setInterval. Hitting pause in the demo page works as expected (setInterval calls are paused). Hitting resume causes the all the events that were paused to suddenly show up. The GIF illustrates this better:
I would have expected the events to show up one at a time after I hit resume? Is this the same bug found by @joydeep-b in #414?
Code for the demo page:
<!DOCTYPE html><html><body><p>This page runs Stopify in the browser.</p><textareaid="data">Output starts here...</textarea><scriptsrc="../../dist/stopify-full.bundle.js"></script><script>varprogram=` onInterval(function() { console.info('callback called') while (false) {} if (paused) { throw 'should have been paused'; } console.log(i++); }, 1000)`;j=0functiononInterval(cb,time){console.info(`onInterval called ${++j} times`)functionhandler(){runner.processEvent(cb,(result)=>{if(result.type==='exception'){window.clearInterval(intervalID)throwresult.value}},console.info);}varintervalID=window.setInterval(handler,time)}varrunner=stopify.stopifyLocally(program,{},{estimator: 'countdown',yieldInterval: 1});runner.g.i=0;runner.g.onInterval=onInterval;runner.g.window=window;runner.g.paused=true;constdata=document.getElementById('data');runner.g.console={log(str){data.value=(data.value+str+"\n")constevt=newEvent('change');data.dispatchEvent(evt)},info(str){returnconsole.info(str)}}functionstart(){runner.g.paused=false;returnrunner.run((result)=>{if(result.type!=='normal'){window.document.title='error';}});}functionshouldResume(){if(!runner.g.paused){returnrunner.resume();}else{returnsetTimeout(shouldResume,100);}}functionpause(){runner.g.paused=true;returnrunner.pause(shouldResume);}functionresume(){runner.g.paused=false;}window.onerror=function(){window.document.title="error";}</script><buttononclick="start()">Start</button><buttononclick="pause()">Pause</button><buttononclick="resume()">Resume</button></body></html>
The text was updated successfully, but these errors were encountered:
This is happening because stopify queues events without timestamps. Should stopify be enforcing the property that if time(e2) - time(e1) = n, then after a pause e2 triggers nms after e1? Presumably, it's important that e1 and e2 are associated to the same event handler.
Also, for reference, chrome debugger can completely stop and restart events in this way (which is not surprising).
I made a page using
test-data/integration/step-with-events
as a template to demo event pausing withsetInterval
. Hitting pause in the demo page works as expected (setInterval calls are paused). Hitting resume causes the all the events that were paused to suddenly show up. The GIF illustrates this better:I would have expected the events to show up one at a time after I hit resume? Is this the same bug found by @joydeep-b in #414?
Code for the demo page:
The text was updated successfully, but these errors were encountered: