https://luma.com/dk641anc
去年看到有人分享的 #VanJS ,很喜歡他 state 的概念,但不喜歡他把標籤和樹狀結構用函數呼叫表示,於是幫自己的 tsjson.html 加了類似的功能,只是還不確定要不要合併進主分支裡。 #sxml #js
比較有趣的地方是, vanjs 裡字串要包成 derive ,我則是在解析成 sexp 時,若有內插 state 變數就自動把整個字串包成一個 derive ,寫起來比較直覺。
https://gitlab.com/gholk/tsjson/-/blob/state-patch/lib/state.js
Had another look at #vanjs yesterday and I'm honestly a bit disappointed.
I like the #html generating aspects of it, but the state management looks incredibly blursed.
Tracking state dependencies with what amounts to a global flag works for smaller projects, but the thought of debugging that in asynchronous code makes me feel dizzy.
State management ain't easy, but this seems like a particularly bad way of handling it.