drufball / layered-apis

A new standards effort for collaborating on high-level features.
275 stars 12 forks source link

Load multiple APIs at once #9

Closed benjamingr closed 6 years ago

benjamingr commented 6 years ago

If I want to use let's say... 10 layered APIs I would have to include 10 script tags for all of the dependencies. If I polyfill from different CDNs (or using a browser that isn't 100% optimized for HTTP2 and modules (currently all of them, but not concerned as this is a spec)) the browser opens multiple HTTP connections which slows page load down.

Should there be a specified way to load multiple APIs at once?

domenic commented 6 years ago

There already is---using multiple import statements or script tags? That loads them all at once.

benjamingr commented 6 years ago

@domenic using multiple imports or script tags can start multiple HTTP connections to the different CDNs

domenic commented 6 years ago

Yes, that's true, assuming you are using 10 layered APIs none of which are supported in your browser, and are for some reason using multiple CDNs.

Just like with normal modules (or normal polyfills), I would not suggest including ten polyfill-of-layered-API modules that are from different CDNs.

domenic commented 6 years ago

I'm having a hard time envisioning what you're asking for here, BTW. Are you saying that you need to use multiple CDNs, and want some magic technology to allow that to be fast or not open multiple HTTP connections? That seems impossible, by the nature of how servers and connections work. (Maybe if you convinced all the CDN companies to colocate to a single server somehow...) Or are you OK using a single CDN---in which case, there is no problem at all?

ojanvafai commented 6 years ago

I wonder if there's something we could do here with web packages. If we have out of band mapping of fallbacks and those fallbacks are then in a web package. Then, in theory, you could construct a system that loads all the fallbacks as a single HTTP request via web packaging.

Lots of "ifs" there. :)

domenic commented 6 years ago

@benjamingr ping; still confused what the ask is here.