4 ms·
I submitted this 3 years back [1] when I was starting. But now I think it's finished and well polished, so I am resubmitting it. I am happy to say that I don't
by franciscop 8y ago
I submitted this 3 years back [1] when I was starting. But now I think it's finished and well polished, so I am resubmitting it. I am happy to say that I don't normally find bugs anymore and the bug reports have slowed down while adoption has skyrocketed [2] [3]
It follows loosely a subset of jQuery methods, but it adds some others where relevant for common JS patterns (.handle() == .on() + e.preventDefault()) and the existing ones are generally more flexible.
[1] https://news.ycombinator.com/item?id=10954191 https://news.ycombinator.com/item?id=10954191
[2] https://npm-stat.com/charts.html?package=umbrellajs&from=2016-01-01 https://npm-stat.com/charts.html?package=umbrellajs&from=201...
[3] https://www.jsdelivr.com/package/npm/umbrellajs https://www.jsdelivr.com/package/npm/umbrellajs
- brennebeck 8y agoLooks interesting. How compatible with jquery is it? You say a subset, but is that an exact subset that would pass tests for those methods? Either way, well done!
- sonofblah 8y agoIs this criterion keeping you from using the framework right now?
- franciscop 8y agoNo, no method would pass all of the tests for said method in jQuery. I believe a part of those tests in jQuery are retroactive to settle the behavior of very edge undocumented cases, which might be different in Umbrella.js. I did in fact try to improve the size of jQuery, but the tests are too coupled to the internal behavior of the methods, even if undocumented and (potentially) unintended initially. So it was very difficult even to change the most basic things, let alone change the internal structure of the whole method. With Umbrella JS I'm trying to get to somewhere closer to native Javascript than jQuery. See for instance the arguments of any looping function (follows similar to the native arrays), or how things like .addClass(name) [1] are thin wrappers around .classList.add(name) (but quite more permissive/flexible). So it will follow closer to classList behavior than to whatever is defined in jQuery's tests, which is a win-win IMHO (since it also makes for a much smaller size, compare to jQuery's .addClass(name) [2]). [1] https://github.com/franciscop/umbrella/blob/master/src/plugins/addclass/addclass.js https://github.com/franciscop/umbrella/blob/master/src/plugi... [2] https://github.com/jquery/jquery/blob/master/src/attributes/classes.js#L27 https://github.com/jquery/jquery/blob/master/src/attributes/...
- pvorb 8y agoNice that you're using npm-stat.com for checking adoption. I should use your library on the site.
- franciscop 8y agoThank for npm-stat! I use it a lot and love it, see my other repos from my website (in my profile). Not sure how much sense it makes for Umbrella JS though, since traditionally it'd be used under a CDN but now with webpack it's treated as another dependency. Indeed, the CDN has remain constant-ish but the npm one has grown quite a bit in the last year. Feel free to use Umbrella JS and ask me any question!
- pvorb 8y agoYeah, right. I thought I still had jQuery in there and thought about replacing it. But now as I looked at the code I realized that it's already mostly using Vanilla JS.
- franciscop 8y agoOh really? I was surprised that there was even jQuery, and after checking it does seem there's a bit of jQuery there. "$" matches 53 times here: https://github.com/pvorb/npm-stat.com/blob/develop/src/main/js/charts.js https://github.com/pvorb/npm-stat.com/blob/develop/src/main/...
- pvorb 8y agoSo I was wrong again. ;-) Just checked the package.json, but it's a static JS dependency that's not transpiled using Webpack.