Open parisholley opened 11 years ago
If my memory serves me correct, http://wordpress.org/extend/plugins/headjs-loader has that functionality built in... might be a good starting point...
Thanks again for such an excellent plugin,
Paul
looks like it was added recently :)
it is a good generic way of doing it (which i may add) but it waits for all scripts to load which adds some delay instead of waiting on the single dependency you really need. one of the reasons I went with my implementation is to be able to register javascript includes by their keys, so you can do head.ready("jquery"), otherwise you will have to do head.ready("http://...") [viewing the head.js, it doesn't support partial url name, like "jquery.js"] which is problematic because you may have scripts that are shared across http/https, or if you have non-inline calls, you have to hardcode url locations/versions.
Idea I have in my head is to find all script blocks that contain jQuery, and wrap it with with head.ready('jquery', function(){ ... }); This would allow plugin to work in admin as well any plugins that write inline javascript.