formula1 / NodeOS-Blog

Blog for NodeOS based off github issues
7 stars 3 forks source link

Code is getting ugly again... #4

Open formula1 opened 9 years ago

formula1 commented 9 years ago

I think I may want to start bringing in async as a clientside dependency as well. However, that in turn increases the size of the api which already takes about 500 ms to load (far longer than it should)

piranna commented 9 years ago

However, that in turn increases the size of the api which already takes about 500 ms to load (far longer than it should)

I think Angular is culprit here, I would have done it in raw Javascript or maybe plain jQuery since mostly it's a XHR and we are not using dynamic binding, only client-side templating that could have been done with mustache or any other Javascript templating, but maybe better HTML Template tag that it's already supported by all current browsers except Internet Explorer.

By refactoring the web app by using standard XHR and HTML Templates instead of Angular, it will need more work but page size will drastically decrease and code will be easier to understand and maintain :-)

(Disclaimer: I'm honestly not an Angular developer, the few things that I've done showed me there's too much magic there for someone that likes to work low level and baremetal... ;-) )

formula1 commented 9 years ago

I was thinking about just in jQuery however went with angular as its the standard for One app pages.

That being said, I definitely have no problems removing the dependencies on it. It probably would be easier to maintain.

Alright

piranna commented 9 years ago

That being said, I definitely have no problems removing the dependencies on it. It probably would be easier to maintain.

:+1:

+async -angular

Are you talking about async.js (the library for parallize code), or about any other thing?

formula1 commented 9 years ago

async.js parallize code. Though I'm currenlty using it as series

https://github.com/formula1/NodeOS-Blog/blob/master/html/footerjs/cacheOrLoad.js

The callback api is a bit ugly, however for now I'll leave it as is. I'm doing Item callbacks to reduce the amount of iterations done.

I probably want to delete everything in memory after I use it as well, however outside of that this can be somewhat closed

I'm not using the template tag due to ie, however, what I'm doing is basically the same thing

Btw, I created a big header at the top for europe ;) But obviously that is better off a little smaller.

We can also have a setting to turn of cached requests if you want. So that it becomes optional

formula1 commented 9 years ago

On an obvious note, caching results also speeds up the page a ton.