|Written by Ian Elliot|
|Wednesday, 13 March 2019|
"With the introduction of a standard library developers will get a well-defined API that does not have to be included with their pages or application. The functionality of the standard library will have gone through a standardization track and will have well-defined APIs and behavior."
The ideas is that built-in modules will be like regular modules, but always available. However, the advantage of this isn't as clear cut as it seems. It might be better to have modules that are downloaded and shared between all web pages or apps. In other words, instead of having them built in, browsers should implement a more intelligent cache to share common standard modules.
To smooth over any transition there are import maps, which tell the browser to ignore downloading a library if it is available as a built-in. This is almost the caching mechanism that is needed. If a browser doesn't support modules, and 80% do, then you need to fall back to loading code in the usual way.
The proposal is at an early stage, but Google has already created the first built-in module for Chrome - KV Storage. This is a simple library that provides a key/value storage engine as an alternative to localStorage or indexedDB, both of which have problems. The whole thing is just an experiment at the moment, but Chrome has got built-in module support. If you want to try it out you need Chrome 74 and you need to turn on the experimental web platform features flag.
Although Google is taking the lead, it does seem to be a valid attempt at establishing a standard rather than a takeover or a feature that makes Chrome better than the competition.
KV Storage: the Web's First Built-in Module
ECMAScript 2018 Is Feature Complete
To be informed about new articles on I Programmer, sign up for our weekly newsletter, subscribe to the RSS feed and follow us on Twitter, Facebook or Linkedin.
or email your comment to: email@example.com
|Last Updated ( Wednesday, 13 March 2019 )|