4 ms·
1) Bundling: Glad you're backing off your anti-bundling position. Good move. 2) JQuery: Any JS library is better when it adds only a single variable to global
by ClayFerguson 10y ago
1) Bundling: Glad you're backing off your anti-bundling position. Good move.
2) JQuery: Any JS library is better when it adds only a single variable to global scope. JQuery uses $. My app uses 'm64'. Anyway what is the better DOM-manipulation API I should be using? Do tell. It has to be an actual competitor to JQuery (i.e. lightweight pure JS library with same DOM capabilities.)
3) Singletons: I use Spring Beans on the server side to be sure I have singletons 'correct', and I use TypeScript namespaces on the browser side. The most common way people screw up singletons is related to the instantiation issues, and circular-references. By using Spring @Component and TypeScript namespaces, I avoid the exact issues you are concerned about. Based on my architecture it's literally IMPOSSIBLE to encounter those issues even if I tried.
- Kiro 10y agoNo-one has argued against bundling. You keep misreading all the comments, adding "bet you didn't know that" to the most obvious things in the world. Why is that? > Any JS library is better when it adds only a single variable to global scope. No, this is how you use jQuery in 2017: import $ from "jquery"; Simple as that. Just stop using global variables.
- ClayFerguson 10y agoBecause of the naming convention i'm using for namespaces, if I ever decide to convert to modules, adding the import statements will be straightforward and nothing will even be renamed. The namespaces would simply 'become' modules, without any editing of the implementation. This was not an accident. I designed it that way.
- Kiro 10y agoAlright. It sounds like something you should add to your TODO. What are your thoughts on for example React, Vue or Angular? Any reason you didn't go that route instead?
- ClayFerguson 10y agoI already had modules on my TODO list, implemented it, didn't like it, took it back out, and converted to TS namespaces. I have been waiting for React to emerge as a clear winner before using it. I only use libraries, APIs, languages, databases, etc. that I've concluded will still be around 10yrs into the future. I don't like Angular, and don't know Vue. If React doesn't replicate some future plans Google has for Polymer ecosystem i might try it.