Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Announcement: New version with support for Promises and an Edge CSS onerror bugfix #87

Open
amorey opened this issue Mar 14, 2019 · 1 comment

Comments

@amorey
Copy link
Member

amorey commented Mar 14, 2019

Hi Everyone,

I just wanted to let you know that we just released a new version of LoadJS (v.3.6.0) that includes a couple of useful features:

First, v3.6.0 adds support for Promises via a returnPromise option:

var prom = loadjs(['/path/to/foo.js', '/path/to/bar.js'], {returnPromise: true});

prom
  .then(function() { /* foo.js & bar.js loaded */ })
  .catch(function(pathsNotLoaded) { /* at least one file didn't load */ });

Second, v3.6.0 includes an important bugfix to detect cross-domain CSS load failures in Edge. Previously, load failures were triggering success callbacks but now they are being handled correctly. The source of the issue was lack of onerror support for cross-domain CSS files loaded via <link rel="stylesheet"> tags. To get around this issue, we are now using rel="preload" to load CSS files in Edge browsers.

Please try out the new features and let me know what you think!

Andres

@asos-tomp
Copy link

great news on the promises support!

It's a little fiddly that the output of the loadJs function is now either a promise or not, it would be really handy to have a function akin to:

loadjs.await(...)

...which takes the same arguments as loadJs() and returns a promise, to enable wrapping of both functions independently without needing to coerce in an extra option.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants