-
Notifications
You must be signed in to change notification settings - Fork 686
feat: Quickstart and client for Plain JS Script Tags #4161
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
63a4d9c to
c07dfef
Compare
Remove the custom Client class that used JSON protocol and HTTP for reducer calls. Instead, use the standard DbConnection with code generation, which uses BSATN binary protocol over WebSocket. The browser-ts template now: - Uses spacetime generate for TypeScript bindings - Bundles bindings with vite into an IIFE - Loads the bundle in index.html with inline JavaScript
…into tien/feat/js-script-tags
|
@cloutiertyler Thank you, I have applied the changes from #4167, merged/resolved conflicts and did a minor template description update. The PR is ready for review. |
The IIFE and ESM browser bundles built from src/browser/index.ts are not used by the browser-ts template (which bundles its own bindings via Vite). The existing dist/index.browser.mjs already covers the browser ESM use case for import maps.
|
Removed the SDK-level browser bundle ( Long-term, the plan is to have the code generator emit |
Description of Changes
The PR implements the following updates:
The bundle is served via
https://unpkg.com/spacetimedb@latest/dist/browser.bundle.js, which only works after the package is published to npm, therefore to test locally we can use thebrowser-tstemplate and local bundle:index.html(swap the URL fromunpkg)browser-ts/index.htmldirectly in browser along withspacetime start+ publish the modulespacetime publish --project-path spacetimedb browser-tsScreenshots
API and ABI breaking changes
Expected complexity level and risk
Testing