What is the benefit of the new Javascript OData library over using jQuery?
相关问题
- Is there a limit to how many levels you can nest i
- How to toggle on Order in ReactJS
- How to fix IE ClearType + jQuery opacity problem i
- void before promise syntax
- jQuery add and remove delay
This library has nothing to do with jQuery.
It makes specialized AJAX and JSONP requests for OData feeds.
This is what they say of the library:
This is a pretty narrow scope of features when compared to jQuery. It seems Microsoft isn't trying to compete with jQuery here, but create an alternate data-access library that interacts with a server using the OData protocol. Indeed, as far as I can tell, jQuery already does all of this stuff, so it seems this is just a way to have access to smart data calls without using the entire jQuery library.
You typically will use them together, as datajs is good at talking to an OData service while jQuery is for comprehensive DOM manipulation and convenient AJAXing. As such a tool, you can implement talking to an ODATA endpoint using jQuery but that's an enormous amount of work - eventually this is what datajs is, and it is over 300K source.
If you would like to have the way jQuery makes your life easy (fluent API, easy intuitive facade) in the field of working with ODATA I'd recommend checking out JayData - "the jQuery in data manipulation".
jQuery is very good at what it does and datajs doesn't try to duplicate any of its features, so it's hard to answer the question in those terms.
datajs currently implements extensive OData support, including multiple formats, support for parsing conceptual models, the ability to enhance results when metadata is known, batch handling, etc.
jQuery supports JSON usage, but that's really just a matter of encoding - there is no support for any OData-specific behavior. If you're talking to an OData server, you'll be better off using datajs, and then you can use jQuery for everything else: animations, document building, controls, templating, etc.