kubetail-org / loadjs

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

Load JS define cache for already loaded JS #94

Closed BicanMarianValeriu closed 5 years ago

BicanMarianValeriu commented 5 years ago

Would not be useful to add a method for adding scripts loaded by other apps to cache ? Eg: I have a list of scripts id's loaded by WordPress and instead of lazyloading the same id again, I would put that list to cache and run code directly.

amorey commented 5 years ago

@BicanMarianValeriu Did you mean to create a github issue? With regards to caching, will the browser cache suffice for your use case?

BicanMarianValeriu commented 5 years ago

I was trying to make a feature request. I'm thinking that is more useful to have that method and also, eg, if script is already loaded by something else (and or plugin), do not throw the error, skip the head appending and actually run the callback instead. Throwing error breaks the js while with the solution above will continue working in case you double load the same script url/id. Makes sense ?

amorey commented 5 years ago

Here's a github issue for your request: https://github.com/muicss/loadjs/issues/95