Skip to content

Cannot .pause with default estimator #465

Description

@arjunguha

The following program works, but if we remove the compiler and runtime settings, it does not:

<html>
  <body>
    <script src="../../stopify/dist/stopify-full.bundle.js"></script>
    <script>
    function sleep(duration) {
      asyncRun.pauseImmediate(() => {
        window.setTimeout(
          () =>  asyncRun.continueImmediate({ type: 'normal', value: undefined }), 
	        duration);
      });
    }

    const program = `
      while(true) {
        sleep(1000);
        document.body.appendChild(document.createTextNode("."));
      }
    `;

   
    const asyncRun = stopify.stopifyLocally(program, {}, {
      estimator: "exact",
      yieldInterval: 200
    });
    asyncRun.g = { sleep, document, window, asyncRun };

    asyncRun.run(() => { });

    window.setTimeout(() => {
      asyncRun.pause(() => {
        document.body.appendChild(document.createTextNode("paused"));
      });
    }, 3000);
    </script>
  </body>
</html>

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions