-
Notifications
You must be signed in to change notification settings - Fork 79
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
convert TS examples (deno, node, sw) to use the new hello-world.html format #488
convert TS examples (deno, node, sw) to use the new hello-world.html format #488
Conversation
* Add `javascript_api` [deploy-site] * Add note about JSON [deploy-site] * Mark SDKs done * Move conditional statement (starfederation#389) * Add release note * Add troubleshooting tips [deploy-site] * Replace http.Flusher with http.ResponseController for SSE in Go SDK (starfederation#392) * refactor: replace http.Flusher with http.ResponseController * refactor: replace http.Flusher with http.ResponseController reintroduced panic justification --------- Co-authored-by: drahtzieher <[email protected]> * Improve SDKs in docs [deploy-site] * Improve `retry` option descriptions [deploy-site] * Wording improvements [deploy-site] * Improve wording [deploy-site] * Fix & unify CDN in docs/examples (starfederation#394) * Try Biome Fixes starfederation#395 * format all * more * fix ignores * Add comment to bundles (starfederation#401) * Add comment to bundles * One-liner * Build * Add `retryInterval` option to `sse()` action (starfederation#393) * Add `retryInterval` option to `sse()` action * Add to `sse` plugin too * Build * Add release note * Add `Datastar's philosophy` [deploy-site] * Use `path/to/datastar.js` [deploy-site] * Fix local signals (starfederation#407) * Fix bundler not exporting module (starfederation#406) * Add Banner and Format * Export Datastar in bundler * Release note * Fix export * Add ref usage example [deploy-site] * updatego deps * Bump org.eclipse.jetty:jetty-server in /examples/java (starfederation#408) Bumps org.eclipse.jetty:jetty-server from 11.0.15 to 11.0.24. --- updated-dependencies: - dependency-name: org.eclipse.jetty:jetty-server dependency-type: direct:production ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Add example to error page [deploy-site] * fix const usage in Go --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: Ben Croker <[email protected]> Co-authored-by: Ben Croker <[email protected]> Co-authored-by: drahtzieher <[email protected]> Co-authored-by: drahtzieher <[email protected]> Co-authored-by: David Linke <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
This reverts commit 251f139.
Ive put it back in draft - suddenly it isn't working from the service worker for me... Perhaps something in one of the dependencies changed... |
Im just dumb - evidently I didnt properly test the most recent changes that I had made (adding minification of template literals) and it was removing @Superpat I know we had talked about minification of html when we were discussing compression. But given that compression is so effective and easy, and that minification of template literals really just amounts to removing line breaks and, perhaps, some comments which dont contribute much to filesize, I don't think its at all worth fixing the sdk to support doing this. Just compress js files and sse responses. As mentioned, Deno will hopefully compress event-steam soon. Here's the PR for it denoland/deno#27776 And its dead-simple with caddy and other reverse proxies. |
@nickchomey I was able to test this today and while the online deno example works fine (and is very good). If I set the network state to offline in my devtools the service worker doesnt work. I've tried in both firefox and chromium. Do I need to do anything else then |
Ah, use Not sure if you have to run deno install first either. I should probably add a basic readme... Though, I was thinking last night that it really should be a simpler demo... I'll review it all later and submit a new commit I've also discovered some gotchas with service workers - in particular, you cant do dynamic imports of scripts with I definitely won't be including anything like that here, but it really ought to be shared in some way Perhaps it would be best to just carry on, and when I'm ready to share an actual case study, I can link to a more comprehensive repo/guide/framework |
I still cant get it to run, I ran
Besides that, I think the demo should be a bit simpler yes, no need for the comparison between streamed / buffered (it's very interesting, but it would be more at home on a blog post or a page on the data-star website, maybe contribute it to the docs pr @bencroker is leading). Ideally it would be the same example as the deno / node examples. Though we could complexify those a little if you want so it's easier to showcase the offline behaviour. I imagine an input that takes a string, a button that says send and an output that is populated by sse with hello $string. Also a readme would be crucial. |
I will work on updating the other examples to the basic example I just detailed. |
Again, you're not building the sw - please look at deno.json and run whichever task you prefer. I use Good idea making it just show the same examples as non-service worker. I'll try to do that today. And, yes, I said I'd made a readme. |
Ah sorry, I thought I ran deno run dev but I ran deno run deno by accident. So it's telling me that esbuild does not support OpenBSD (which is strange since I can run the go version of esbuild just fine). Would you be willing to use deno dnt to build the service worker instead ? You can look at |
For the example, I want to have a single html file in 'sdk/typescript/examples/static' that is served by each example so that they only have to serve it and then expose an sse route that updates the view. Feel free to create that file if I dont get to it before you update your example, I'll use it for the others. |
@nickchomey for your example best to follow whats discussed here: https://discord.com/channels/1296224603642925098/1296225449260879973/1333463946317009027 by @bencroker |
Put this into draft mode. I will work to convert this example and the existing deno.ts and node.ts examples to use the hello-world.html example that is now the standard for all sdks |
I broke something while trying to merge upstream. Im just going to close this and start a new PR branch... |
This adds an example for the typescript sdk that has isomorphic routing and rendering for deno and a service worker. If you go offline, everything will be served from the SW.
There's a few files that are probably extraneous - caddyfile, mise.toml. Not sure what to do about those since I'd like to have them in my own repo