Head.js `.js()` method

163 Views Asked by At

I have some code I inherited from my job, and it uses an api call from head.js:

head.js( { 'application' : 'someurl.com/foo.js' });

Does this register the javascript asset as application, so when I call

head.load( 'application' );

the right behavior will happen? I couldn't find this method in the head.js api page, nor in a google search.

1

There are 1 best solutions below

0
On BEST ANSWER

head.js( { 'application' : 'someurl.com/foo.js' }); - means that you add label to loading some foo.js file then you can use ready function to callback a function that do some stuff. For example:

// Labels are usually used in conjuntion with: head.ready()
head.ready("application", function() {
   // do something
});

head.load( 'application' ); - will tries to load application file for root folder.