kubetail-org / loadjs

A tiny async loader / dependency manager for modern browsers (899 bytes)
MIT License
2.58k stars 150 forks source link

Announcement: New version with support for simpler callback syntax #56

Open amorey opened 6 years ago

amorey commented 6 years ago

Hi Everyone,

I just wanted to let you know that the latest version of LoadJS (3.5.2) accepts a success function as a simple callback argument:

loadjs(['/path/to/foo.js', '/path/to/bar.js'], function() {
  // foo.js & bar.js have loaded
});

For access to more advanced features you can still pass in an object as an argument:

loadjs(['/path/to/foo.js', '/path/to/bar.js'], {
  success: function() { /* foo.js & bar.js have loaded */ },
  error: function(pathsNotFound) { /* at least one path didn't load */ },
  async: false
});

I hope that helps to simplify your LoadJS syntax! Please let me know if you have any questions or suggestions.

Andres

P.S. Special thanks to @W1zzardTPU for the suggestion and the PR!