If you are curious how a JavaScript framework like Vue.js works behind the scenes, here is my personal approach to built my own framework.
This propably won't be continued. I just wanted this to be like a proof of concept.
This just has two functions implemented.
- Replace the {{placeholders}} with an actual string which is provided in the initial Object
- Create a simple for-loop that loops through an Array and replaces the basic element in the template
- Show how it works to overload the setter of a given variable to trigger rerender on change
- Implement an async API-Call to JSON-Placeholder to thow that it actually works!
I've tried to comment my code as much as possible.
I isn't hard to find bugs if you try hard enough. As I already told you: This is just some kind of POC.