5 ms·
Yeah, though jQuery has helped a lot to make some sort of "standard library", requirements in the browser (small file size) makes it really hard to bootstrap a
by rtpg 10y ago
Yeah, though jQuery has helped a lot to make some sort of "standard library", requirements in the browser (small file size) makes it really hard to bootstrap a "standard library for JS".
I would love for browsers and other VMs (well, Node) to aim for Python-level standard library that would be integrated into the VM. We could get a bunch of functionality without having to ship 3 Meg files to everyone.
Here's a proposal: FF starts building a "standard library for Javascript". Developers can start using it, or provide polyfills for the bits they use through a special script tag like:
<script src="std-lib-poyfill.js" standard-lib-polyfill></src>
So FF would know not to pull it in but other browsers would know. Maybe a version number/point release in there too.
There might be a bit of competition between browsers but I think we could quickly reach a consensus on most things.
... Though I guess this is what standards are for. I would like to see a browser try this anyways, though. That would be the fastest way to get the standards bodies to acknowledge the problem.
- BinaryIdiot 10y ago> Yeah, though jQuery has helped a lot to make some sort of "standard library", jQuery is mostly a better library for dealing with the DOM though. It has support for making network calls but those don't work in node without polyfills. > Though I guess this is what standards are for. I would like to see a browser try this anyways, though. That would be the fastest way to get the standards bodies to acknowledge the problem. I mean fetch exists and is an HTML 5 standard that's fairly decoupled from the DOM, unlike XMLHttpRequest. But it has to also work in node.js. I wrote a set of HTTP methods in my msngr library that works in both node.js and the web browser but it feels like a hack. I want my language to have first class networking and file io.
- aviraldg 10y agoDid you try isomorphic-fetch?
- BinaryIdiot 10y agoNo; node and the browser provide APIs that do this already they're just very different so I simply wrapped them to avoid dependencies (it was pretty easy). But I knew of it and it's a good idea.
- yoshuaw 10y ago> I would love for browsers and other VMs (well, Node) to aim for Python-level standard library (...) Node has a cultural disliking for big standard libraries, preferring to delegate to the package manager instead. If anything the API might shrink further, not get added to.