Feature: add the ability to remove scripts from the cache
Opened this issue · 5 comments
In the source, the scripts
variable holds a cache of all the scripts that have been loaded. Sometimes, if someone wants to hot-swap libraries out, they need the ability to clear this cache entry so that they can load a new version of the library in its place. I'd recommend something like $script.unload(path)
to remove an item from the cache.
Was this resolved? If not is there a workaround?
No idea if this has been resolved. Haven't heard anything since
Hi @gaitat and @fresheneesz. I'm having a hard time understanding the use case for unloading a script since you can't undo code once it has been run?
In my specific case I have code that runs under one version of a library (A-1.0.js) and some other code that runs with another version of a library (A-2.0.js) and the two versions are incompatible. In my main app I query the user which library to use to view the results. So when they choose to view results based on version A-2.0.js, I have to unload version A-1.0.js and vise versa.
script.js was nice because each one of my versions had other dependencies that I could load but the no-cache thing was a deal breaker for me.
i gotcha. i'm afraid that might be outside the scope of this library