Live data from Hacker News

jQuery 3.0 Release Candidate

blog.jquery.com

51–60 of 71 posts

Re: jQuery 3.0 Release Candidate

#51

Earlier quoted context omitted.

Fetch support is awful. Rachel McAdams knew the future.

Plenty of polyfills out there. I mentioned it because it's a lot lighter than superagent or worse, request.

Honest question, what is wrong with request (and superagent)? Is it just size or something more? I am only asking because yesterday I was looking for a promise supported library and I was comparing superagent (with its promise wrapper), request-promise, axios and node-fetch. I have narrowed it down to axios and fetch but I would like to hear your opinion on the matter.

Re: jQuery 3.0 Release Candidate

#52

Since I used d3.js for one project a few years ago, I have not touched jQuery ever since. d3 offers key jQuery features, but goes much more beyond that.

It lacks a ton of key features. No eq(), toggleClass(), show(), length, etc. Sure you can rewrite them in D3 but why bother?

Re: jQuery 3.0 Release Candidate

#53

Exciting news for jQuery. Last night, I was working on a side project. For the front-end, I'm using React, React-Route, and I'm working on figuring out Fluxible. superagent to wrap XmlHttpRequest. browserify to compile what I serve to the front-end. I don't run a reverse-proxy with a node backend since the API is in PHP, I just served the minified JS files. Honestly, it's a huge pain. And every module I toss in there…

This sounds like a big deal but that is effectively what you have to learn either way. The difference is that one is built in a competitive landscape and the other is done in a big god object.

Re: jQuery 3.0 Release Candidate

#54
post #51

Earlier quoted context omitted.

Plenty of polyfills out there. I mentioned it because it's a lot lighter than superagent or worse, request.

Honest question, what is wrong with request (and superagent)? Is it just size or something more? I am only asking because yesterday I was looking for a promise supported library and I was comparing superagent (with its promise wrapper), request-promise, axios and node-fetch. I have narrowed it down to axios and fetch but I would like to hear your opinion on the matter.

The size. For a Node app, maybe not so bad (though I'd use node-fetch or got[1] which are smaller). For a browser app, loading all of superagent (which is almost 2 megabytes) just to make a few GET and POST calls is silly.

Never used axios but I've heard good things about it and its creator is awesome. I just use fetch because it does what I want.

[1] https://github.com/sindresorhus/got

Re: jQuery 3.0 Release Candidate

#55

Earlier quoted context omitted.

Fetch support is awful. Rachel McAdams knew the future.

+1 for fetch. Use the good github fetch polyfill for old browsers https://github.com/github/fetch

I tried fetch, the polymorphic-fetch module that builds on this github one and found it doesn't support .finally(), or work with the promise.finally polyfill (yes I know it's not in the spec, but seriously).

Also sinon.js couldn't mock it, and dealing with error cases is inelegant (it doesn't look like much extra code, but is hard to justify if you're just writing a small component that hits one endpoint, in terms of weird new code to explain to your teammates that is).

I have gone back to $.ajax for now, though I do mean to try out qwest [1] when I get the chance. Seems to be both tiny and also have a sane promise-y API.

[1] https://github.com/pyrsmk/qwest

Re: jQuery 3.0 Release Candidate

#56
post #51

Earlier quoted context omitted.

Honest question, what is wrong with request (and superagent)? Is it just size or something more? I am only asking because yesterday I was looking for a promise supported library and I was comparing superagent (with its promise wrapper), request-promise, axios and node-fetch. I have narrowed it down to axios and fetch but I would like to hear your opinion on the matter.

The size. For a Node app, maybe not so bad (though I'd use node-fetch or got[1] which are smaller). For a browser app, loading all of superagent (which is almost 2 megabytes) just to make a few GET and POST calls is silly. Never used axios but I've heard good things about it and its creator is awesome. I just use fetch because it does what I want. [1] https://github.com/sindresorhus/got

Wow, had no idea that request was so bloated. And thanks for mentioning got. I just checked it out and I think that is the lib I will be going with on the backend. I love the stream support, very cool.

Re: jQuery 3.0 Release Candidate

#57
post #48

Exciting news for jQuery. Last night, I was working on a side project. For the front-end, I'm using React, React-Route, and I'm working on figuring out Fluxible. superagent to wrap XmlHttpRequest. browserify to compile what I serve to the front-end. I don't run a reverse-proxy with a node backend since the API is in PHP, I just served the minified JS files. Honestly, it's a huge pain. And every module I toss in there…

Curious - why are you using React and all of that for a simple 2 page project? Is it for the learning experience? Seems like way overkill unless its for the learning experience.

how did you get that idea?

he needs most of the libraries only on two pages: login and register. i sincerely doubt his site only has these two.

Re: jQuery 3.0 Release Candidate

#59

Since I used d3.js for one project a few years ago, I have not touched jQuery ever since. d3 offers key jQuery features, but goes much more beyond that.

It lacks a ton of key features. No eq(), toggleClass(), show(), length, etc. Sure you can rewrite them in D3 but why bother?

eq() is equivalent to selecting an item from an array and can be replaced by using bracket notation (e.g., arr[1]).

In D3 you can do selection.classed('active', false). This is equivalent to toggleClass().

According to jQuery's API, show() "... is roughly equivalent to calling .css( "display", "block"), except that the display property is restored to whatever it was initially." Instead of show, you can just do selection.transition().duration(300).style(display, 'block').

The length method? You can just use JavaScript's native .length.

Re: jQuery 3.0 Release Candidate

#60
post #6
post #2

Major Changes: .load, .unload, and .error, deprecated since jQuery 1.8, are no more. Use .on() to register listeners. jQuery.Deferred is now Promises/A+ compatible Error cases don’t silently fail Animations now use requestAnimationFrame Massive speedups for some jQuery custom selectors

> jQuery.Deferred is now Promises/A+ compatible Finally. Our old codebase is using quite a lot of jQuery deferreds and, well, Promises/A+ clearly improved a lot of things API-wise.

jQuery.Deferred was such a convoluted api for me. I polyfilled a Promises lib and felt bad having multiple libraries that on the cover said they did the same things.
Post reply on HN