3 ms·
Show HN: _hyperscript – an async-transparent scripting langauge for the web
Hi Folks,
We have been working on an experimental front
end programming langauge, hypescript, as a companion project for htmx.
https://hyperscript.org/
Its syntax is based loosely on HyperTalk, the scripting language for HyperCard.
It has some feature that the HN crowd might find interesting:
Async-transparency - as much as possible, the runtime tries to hide the
distinction between synchronous and asynchronous code
https://hyperscript.org/docs/#promises
https://hyperscript.org/docs/#async
Event driven - events are treated as first class citizens, including
event-based control flow
https://hyperscript.org/docs/#event-control-flow
CSS Literals - you can refer to elements in the DOM directly with syntax like
#foo, .bar and <button/>
on click add .highlight to <button:not([disabled])/>
Extendable language - the parser is pretty open and flexible, allowing you
to add new "commands" (statements) to the language
https://hyperscript.org/docs/#extending
Integrated Debugger - the language has a (very alpha) integrated debugger
https://hyperscript.org/docs/#debugging
Inline Web Workers - the ability to define a web worker directly in your page
https://hyperscript.org/docs/#workers
There's a fair bit of other stuff too, SSE and Websocket support, a slew of
useful commands for working with the DOM, etc.
This is very early, 0.0.6, so please be gentle, but it is being used in a few
places in production. I used it to make the / key jump to the search box
on htmx.org, for example.
- benboughton1 6y agoI've just started testing this on a side project as I got a bit excited about htmx. I like the idea of forming HTML templates in Flask/Jinja2 so the hyperscript/htmx toolset should be a good fit. I don't really have much comment or advice yet except writing in hyperscript is a bit back to front but the documentation really helped. I think once I get my head around it, it will be super productive. And just inject pure JS when needed. Sounds great! No IDE clues or error checking makes it a little harder too for the minute :) I'll keep working away at it.