I would like to make something like this (similar to c#):
using("content/jquery.js");
$("div").fadeOut();
So if content/jquery.js is not on a script in the head I would like to load it and continue the execution after it loads.
Is it possible to implement this or something similar? Note: I could have more than 1 using
These are called script loaders.
You can take a look at RequireJS, which behaves in a very similar way:
There’s also LabJS and ControlJS, which are more focused on async script loading rather than dependencies, but may be worth checking out. Also in this category, our very own @jAndy’s SupplyJS.