Echo JS 0.11.0


jaleksic comments

jaleksic 59 days ago. link 1 point
Darn! I accidentally hit downvote - I'm so sorry!
@tracker1 feel free to revert that, if it's possible
jaleksic 117 days ago. link 2 points
Very interesting topic in my opinion, but the article is really hard to read (possibly a machine-based translation). Also, while it indicates the problematic areas, it doesn't go into possible solutions, but I guess that's fine - the title says it's about the struggle :)
jaleksic 180 days ago. link 2 points
I think that compiles-to-js doesn't count in this context, because that can be said about a great many languages. And I think what makes typescript different here is that it's a superset of Javascript. Coffeescript, well. Haven't seen it much lately :)
Also, personally I am not interested in webassembly articles on echojs although I am interested in the technology - I think it's simply a differently world, and probably deserves and has it's own community. I have a similar opinion about flutter and dart.

If I were interested in let's say HTML and had an aggregator for that, I wouldn't want react or JS there, even if we use it to produce HTML.
jaleksic 189 days ago. link 2 points
Since you don't support objects as in e.g `classnames({ isActive })`, I guess you might improve performance a little by using `typeof arg === 'string'` instead of the more expensive `Array.isArray(arg)` call.
jaleksic 202 days ago. link 1 point
I know this is not strictly JS at all :)

However I use this technique in several projects, always copy pasting a gist at GitHub.

Thought I'd publish and share it, as it's really useful.
jaleksic 247 days ago. link 1 point
Totally kills my mobile browser with all codepens executing. Nice collection nonetheless.
jaleksic 255 days ago. link 1 point
Also, feel free to use @loopmode/events for this. It will use only a single DOM event listener no patter how many components use your hook! (Shameless self-advertising here, I wrote it, but it's a perfect use case)
jaleksic 256 days ago. link 2 points
I'm still in the "meh" phase, even after months of working on some projects that use typescript as well.
I do see the benefits, no question, but I'm still not 100% convinced. It might be more pleasant to write, but it's terribly noisy to read.
It does encourage writing more performant code tho. The stricter you type, the better your resulting JS can be optimized by e.g. V8.
You can write performant JS manually too, but it takes a lot of experience and discipline.

Just recently I migrated a library of mine to TS where the very complicated typing basically rubbed in my face that my JS was simply bad. It was about a flags object in the concrete case, and usually it had string keys and boolean values, but in some cases it could have string values for certain keys. After struggling a lot to properly type all modules and functions that consuming that object, I gave up, accepted that my approach was shite, and rewrote the architecture to use monomorphic objects instead, introducing a new and separate logic that deals with the string case. Now stuff is much cleaner, overall and if it were to scale, it would surely even perform better.

Still, I'm not 100% convinced yet. You read a lot that you don't have to type everything, and you can just add TS on top of js because it's a superset blah blah. In my experience, that's not realistic, and going Typescript does take away the expressivity of Javascript (one of its best features). 
Let's see. Hated Javascript for years, now I love it :)
jaleksic 293 days ago. link 1 point
"There you have it. If you just wanted a sticky header and didn't need to know what the section you are currently looking at you could have simply added just the position: sticky. The ability to click buttons to scroll to sections, and highlight the section the user is in provides a nicer experience." :)