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 image loading (v3.5.4) #63

Open
amorey opened this issue Mar 28, 2018 · 0 comments
Open

Announcement: New version with support for image loading (v3.5.4) #63

amorey opened this issue Mar 28, 2018 · 0 comments

Comments

@amorey
Copy link
Member

amorey commented Mar 28, 2018

Hi Everyone,

I just wanted to let you know that the latest version of LoadJS (v3.5.4) includes support for images (.png|.jpg|.gif|.svg). Here are some things you can do with the new functionality:

  1. Execute code after an image has finished downloading

    loadjs(['/path/to/foo.png', '/path/to/bar.css', '/path/to/thunk.js'], function() {
      /* foo.png, bar.css and thunk.js loaded */
      var img = document.createElement('img');
      img.src = '/path/to/foo.png';
      document.body.appendChild(img);
    });
  2. Detect download errors

    loadjs(['/path/to/foo.png', '/path/to/bar.css', '/path/to/thunk.js'], {
      success: function() { /* foo.png, bar.css and thunk.js loaded */ },
      error: function(pathsNotFound) { /* at least one path didn't load */ }
    });
  3. Include images in bundle definitions

    loadjs(['/path/to/foo.png', '/path/to/bar.css', '/path/to/thunk.js'], 'foobarthunk');
    
    loadjs.ready('foobarthunk', function() {
      /* foo.png, bar.css and thunk.js loaded */
    });
  4. Force treat a file as an image using an "img!" prefix

    loadjs(['img!/path/to/image.custom'], function() {
      /* image.custom loaded */
    });

I hope this helps to simplify your frontend loading issues! Please let me know if you have any questions or suggestions.

Andres

https://github.com/muicss/loadjs

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

1 participant