3 ms·
Wow I am loving this. I had a very related question on the htmx discord (ie can we load content from "any function" instead of an endpoint. My use case was t
by flashgordon 11mo ago
Wow I am loving this. I had a very related question on the htmx discord (ie can we load content from "any function" instead of an endpoint. My use case was that I used the FE (in typescript) in a very stateless way and had most of the logic driven by a go-wasm binary (the binary was pretty much the "M" and "P" in MVP). When I saw the Wasm binary here in the post it gave me a bit of relief. Cant wait to see this direction take off!
- recursivedoubts 11mo agoIn htmx 4.0 you are able to do pretty much anything, up to and including replacing `fetch()` with your own implementation on a per-request basis. So you should be able to achieve pretty much anything at that point. A nice side-effect of moving to fetch.
- flashgordon 11mo agooooh nice. We are truly going to a fucntional world! The (pesky) "http fetch" is now just a detail it sounds like?
- recursivedoubts 11mo agoYes, you can see the code here: https://github.com/bigskysoftware/htmx/blob/24e6d5d7c15e34c924c006420c6e2d84172fdcc7/src/htmx.js#L499 https://github.com/bigskysoftware/htmx/blob/24e6d5d7c15e34c9... We bind `fetch` in the `ctx` object to the standard `windw.fetch` but you can replace it with whatever you want (for example in the `htmx:before:request` event triggered immediately afterwards) Pretty much everything is swappable using this technique.