2

I've just revised my title. The question I started asking was what are the Javascript equivilents to .Net's BCL, or C's standard library.

I think the answer to that is that each browser exposes a set of services as objects like XMLHttpRequest.

I assume these XMLHttpRequest like objects are designed into the Javascript engine of each browser so as to enable things like network communication.

I don't see these defined anywhere in the ECMA spec, so is there a set of services all browsers are expected to support? If not, and I'm guessing not is likely, how do you find what each browser has available? I assume libraries like Socket.IO abstract away the details of each browser's available functions.

I can't find any specifics though as I'm not really sure what I'm looking for exactly. If you search for networking in Javascript you get pointers to a lot of useful libraries, but it is what they are abstracting that I'm interested in.

Do objects like XMLHttpRequest have a specific family name? Like the BCL in .net?

Ian
  • 4,885
  • 4
  • 43
  • 65
  • 4
    They're called [host objects](http://stackoverflow.com/questions/7614317/what-is-the-difference-between-native-objects-and-host-objects). – Blender Sep 13 '13 at 22:05
  • 1
    I think you should be looking at W3C HTML5 specs (all zillion of them) – Pointy Sep 13 '13 at 22:05
  • 1
    there are many "services" available, and although most modern browsers should support most of them (like XMLHttpRequest), If you use an API, especially if it is an HTML5 API, you will need to check for browser compatibility. you can see a list here: https://developer.mozilla.org/en-US/docs/Web/API – kennypu Sep 13 '13 at 22:06
  • That helps a lot. One related question based on the comments. For html 5 the range of api s seems quite clear. What about html 4? – Ian Sep 14 '13 at 16:37

1 Answers1

0

Web developers are groping in the dark, hence no decent answer in two years (lol).

The situation is likely to stay that way, because the code was NIH.


As stated in comments, there are host objects which are supposed to be implemented the same way in all browsers. There is also a long list of APIs that are drafted, recommended or standardized (but I would not rely on that list).

In reality, if you want to write anything remotely serious in JavaScript (i.e. a company pays you to write features that users will pay for), you would tend to gravitate towards "abstraction APIs". These are developed by other companies or individuals (thank you!) and without them, web-development would be really, really dull.

  • AngularJS, React, Backbone
  • jQuery, Zepto
  • Modernizr, Lodash, Moment.js
  • mustache.js

... just to name a few. A good way to get a list of "current libraries" would be to scrape SO for tags and see the ones most associated with JavaScript. You can also do a lot of crazy stuff in the browser through NodeJS.

Community
  • 1
  • 1