Skip to content

Put simulator time, timers, randomness and environment behind pxsim.host - #11779

Draft
Eric Anderson (humanapp) wants to merge 1 commit into
masterfrom
humanapp/stack/1-simcore
Draft

Eric Anderson (humanapp) wants to merge 1 commit into
masterfrom
humanapp/stack/1-simcore

Conversation

@humanapp

Copy link
Copy Markdown
Collaborator

First of the stacked PRs replacing #11665.

The runtime, animation queue, and math shims now read time, timers and random numbers through pxsim.host.

  • domhost.ts is the host that installs in the browser. The browser behaves as before.
  • virtualhost.ts adds a host whose clock moves only when stepped and whose random numbers come from a seed. Used by the headless runner, which comes later in the stack.

…xsim.host

The runtime, the animation queue and the Math shims read time, timers and random numbers through pxsim.host instead of the globals, and the runtime reaches the parent window, the page URL and the frame id through a host environment that domhost.ts installs in the browser. The defaults are Date.now, performance.now, the global timers and Math.random, so the browser behaves as before. A virtual host whose clock moves only when asked, and whose random numbers come from a seed, is included for running programs deterministically; nothing uses it yet. The timer fields on Runtime are typed as host.TimerHandle instead of any.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant