Allow the use of another rendering than DOM
See original GitHub issueI discussed a lot about this feature on Slack, and now I come to you with some real news and experiences.
At the moment, Hyperapp is used as “a JavaScript library for building frontend applications” (from the readme). But I was fall in love about Hyperapp, and I think it can allow a lot more.
Thinking about it Hyperapp is a store (state/actions management) with a render on update feature. Now Hyperapp is rendering on the DOM through its VDOM logics. But I am not asking to remove it.
What I am asking is to permit user to use the view
function for something else than rendering into the DOM.
I found a pretty clean solution to do that in less than 10 Bytes (min+gzip). https://github.com/Swizz/hyperapp/commit/3109c4638ef070b0d5bbb6dcfa7ba6298a711c68
But this one is not really good and work only in a node context, because in a node context you are able to override document.body
.
Another solution could be to do not call the patch function if appView()
to do not return anything.
https://github.com/Swizz/hyperapp/commit/d9608af656e6a267cdce9937581ce584d5e40854
And this one make sense too, as returning nothing from a view may cause an error. https://github.com/hyperapp/hyperapp/blob/fragment-state/src/app.js#L209
I dont know what I am supposed to write to convince you so I made a pretty simple example of a terminal app using Hyperapp.
repo : https://github.com/Swizz/hyperapp-term-poc
app : https://github.com/Swizz/hyperapp-term-poc/blob/master/src/app.js
Issue Analytics
- State:
- Created 6 years ago
- Reactions:3
- Comments:6 (5 by maintainers)
@Swizz Now that #385 is merged, you are welcome to send us a PR. 🔥🤘🔥
I’m gonna close this one until further works