knowthelist / fhem-tablet-ui

UI builder framework for FHEM
MIT License
148 stars 84 forks source link

Javascript Encapsulation #121

Closed ManOki closed 7 years ago

ManOki commented 9 years ago

Current Javascript (from fhem-tablet-ui.js) has several weak spots:

additional references: http://debuggable.com/posts/how-to-write-jquery-plugins:4f72ab2e-7310-4a74-817a-0a04cbdd56cb http://www.codeproject.com/Articles/757949/JavaScript-Encapsulation-using-Anonymous-Functions http://javascriptissexy.com/oop-in-javascript-what-you-need-to-know/

knowthelist commented 9 years ago

But it works for my case :-) fhem-tablet-ui.js is my main class, not just an object. Any concrete proposal for what has to be changed?

knowthelist commented 9 years ago

I see what you mean. Another good reference https://learn.jquery.com/code-organization/concepts/

ManOki commented 8 years ago

Sorry for late response and don't get me wrong, fhem-tablet-ui is great!

in my case, i added templates (https://plugins.jquery.com/loadTemplate/) to group multiple elements (like heating thermostat with 2 buttons for boost and off mode). unfortunately i was unable to set a specific load order, so your javascript was executed before templates were loaded and did not add the fhem-tablet-ui magic to my elements.

so i tried to understand your code and didn't got a clue about whats going on there. this issue is more a hint for good programming style than an actual request for change ;) i don't mind, if you just close it.

thanks

knowthelist commented 7 years ago

completely finished now. Thanks for the awesome hint.