4 ms·
With vanilla JS you'd have to gather your parameters, encode them, call fetch, resolve the promise (and handle errors), and decode the result. Then you still n
by sawka 5y ago
With vanilla JS you'd have to gather your parameters, encode them, call fetch, resolve the promise (and handle errors), and decode the result. Then you still need some sort of frontend data model to "set" the fetched data in. Now you need functions to update the DOM. It isn't like it can't be done, but it ends up being 10-15 lines of code, when you can do it in Hibiki in 1-2 (with a UI that looks more declarative).
So for Python/Flask, you can just write standard AJAX handlers that return JSON. You can also write special JSON payloads called hibiki "actions" that can set data directly into the data model, update HTML, fire events, or even call other handlers. People knock this approach because it tightly binds your backend to your frontend. But for simple tools, that logic has to exist somewhere -- if you're a Python programmer, it can be simpler to write it in Python than in JavaScript. Whatever gets the job done.
- the__alchemist 5y agoYour explanation makes sense - thanks!