kubetail-org / loadjs

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

Allow simple invocation of loadjs.ready #54

Closed W1zzardTPU closed 6 years ago

W1zzardTPU commented 6 years ago

Instead of loadjs.ready(['foo', 'bar'], { success: function() { } });

this can be used

loadjs.ready(['foo', 'bar'], function() { });

amorey commented 6 years ago

@W1zzardTPU Thanks for the PR. I think it will be useful to pass a callback function as an argument. Here are a couple of questions:

  1. Should the callback function execute only on success? What happens on error?
  2. Should loadjs() also accept a callback function as an argument?
W1zzardTPU commented 6 years ago

1) For simplicity I was thinking just execute on success, do nothing on error. If more control is needed, pass an array as currently supported. 2) I have no use for that functionality, but I can see how it could benefit other scenarios and it would make the API more uniform

amorey commented 6 years ago

Thanks for the clarification. Here are some modifications for your consideration: https://github.com/W1zzardTPU/loadjs/pull/1