Open amorey opened 6 years ago
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:
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); });
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 */ } });
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 */ });
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
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:
Execute code after an image has finished downloading
Detect download errors
Include images in bundle definitions
Force treat a file as an image using an "img!" prefix
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