slipHQ / run-wasm

Run WASM based code executions in the browser easily
https://www.runwasm.com
Apache License 2.0
468 stars 47 forks source link

Refactor: Only load TypeScript client once in /ts #80

Closed mcintyre94 closed 2 years ago

mcintyre94 commented 2 years ago

This PR refactors the /ts page so that it only calls createTSClient once, in the same way as the Python ones. This means that when we add preloading of libs (see #79), that code will be run only once - before any user-entered code is run.

Note that I've put this into a useEffect even though it's synchronous, because we'll need this structure once we do want to call an asynchronous preload function. I've commented out an example of how this would look.

vercel[bot] commented 2 years ago

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/sliphq/run-wasm/DAWdstbEt73rW28tgtQYZPRpwZVu
✅ Preview: https://run-wasm-git-fork-mcintyre94-load-ts-once-sliphq.vercel.app