-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using a template system, instead of inline-HTML #245
Comments
Btw, the extra advantage of seperating the "model" and the view (template), we can unit test the code. Now it's almost impossible to unit test the code, for expected behavior, since the code is changing a lot in the DOM. NOTE RactiveJS != ReactJS ;) |
Hi, Good idea to make the code more unit testable. I can tell you: the code already improved a lot over the last few month. I made some huge changes in removing duplicate code and handling stuff more alike. I don't know ractive (sound like just another JS library ;)). The disadvantage from using such a framework could mean a lot of overhead, while most of the stuff also can be done in VanillaJS (splitting the logic and the html can also be done there). Using a framework can mean that performance on slower tablets gets terrible. |
Happy to hear that a lot of changes are done the last months. I indeed already noticed some code cleanup, but still I see a lot of stuff that can be deduplicated and/or improvement. I agree, I try to avoid more and more frameworks. Just an extra note, RactiveJS is a template engine, not a framework (like jQuery, or Angular, etc). |
Oh, for sure a lot can be improved. But step by step, otherwise we break everything (which already happens sometimes). We can give it a try of course. Let's play with it in a branch and see how it performs. |
I totally agree, we should do it step by step. Maybe only use it for new blocks? Or new plugins, so we can start testing it. |
Good idea! |
Sure, I started working an simple PoC, so you guys can see how it works |
Hi @aalwash How's the PoC going? Already something we can have a look at? |
Hi @aiolos I did make a start a while ago, but some other priorities kept me busy |
No worries, I also had a bit of a quiet period on Dashticz. I was just wondering if I had maybe missed something. |
…rted the coins block into a template I couldn't test liteBit, since it doesn't work for me Issue Dashticz#245
@aiolos @robgeerts So the ideas is as follow:
Template module
Let me know what you think about this Note
|
In case you want to see the diff, use this url aalwash@5ed60db |
Did anyone check it out :)? |
Sorry, busy times for me (as always). |
Hi, I didn't check it out yet. These days a bit busy on other things, but I'll definitely have a look. It sounds promising. Cheers |
No problem, take your time :) I already trying to experiment with unit testing and JS code that is normally written for browsers :( |
Just tested it, works great :) |
@robgeerts hmm, strange, I somehow forgot to add that. I will try to continue working on a simple unit test for now and I will do a PR after that |
Hi,
I'm using the dashticz system now for a few weeks and it's awesome.
However, the inline-HTML in the JS code does bother me a lot.
Did you guys think about using a light template JavaScript engine?
I previously used Mustache and after that I used Ractive.js
Ractive.js is Mustache on steroids and has a lot of cool options (looping, two-way binding, partials, events, conditional sections, etc)
I think this will clean up the code a lot and make it more bug-"proof"
Of course, this a big change and a huge challenge, so this should be done in small peaces.
Check the tutorials https://ractive.js.org/tutorials/hello-world/
What do you guys think?
The text was updated successfully, but these errors were encountered: