I also wondered about the complexities of implementing Vue so I made a small clone sometime ago, put it on github so one can see the moving parts of a Vue-like that supports things like arrays, else blocks,etc. The functionality needed was about 500 LoC. (Some bad variable names here and there still since it was mostly a quick-hack for my own learning but put it up anyhow)
The Vue/Angular demo files make use of `new Proxy()`. To the devs knowing these frameworks: is that best practice, or asked differently, are these representative examples?
Vue switched to proxies in v3. They haven’t had great browser support for a very long time, and if I remember correctly, polyfilling them was difficult.
Yeah, the Vue-like I made (other comment) was my second attempt at it and this time using just Proxy to simplify things. The first time I had tried to do it as Vue did previously with defineProperty but it was a damn mess to try to support arrays,etc and honestly the code was never stable (and using Vue V2 you can also run into a few edge-cases like missing properties missing reactivity).
I also wondered about the complexities of implementing Vue so I made a small clone sometime ago, put it on github so one can see the moving parts of a Vue-like that supports things like arrays, else blocks,etc. The functionality needed was about 500 LoC. (Some bad variable names here and there still since it was mostly a quick-hack for my own learning but put it up anyhow)
https://github.com/whizzter/picotpl
The Vue/Angular demo files make use of `new Proxy()`. To the devs knowing these frameworks: is that best practice, or asked differently, are these representative examples?
No, these aren't representative examples of how you would use Angular.
Angular code wouldn't use any of these techniques:
But, I'm not sure that's what the author is trying to do -- I think they're trying to show what is going on under the hood, coded in pure JS.In that context, it's probably relevant to show this (assuming it's indicative of what Angular actually does -- of that I'm less sure)
Vue switched to proxies in v3. They haven’t had great browser support for a very long time, and if I remember correctly, polyfilling them was difficult.
Yeah, the Vue-like I made (other comment) was my second attempt at it and this time using just Proxy to simplify things. The first time I had tried to do it as Vue did previously with defineProperty but it was a damn mess to try to support arrays,etc and honestly the code was never stable (and using Vue V2 you can also run into a few edge-cases like missing properties missing reactivity).
Proxies work across all mainstream browsers. Only the rare IE holdout would be a problem.