I recently read a jQuery tutorial about best practices. I usually run all my functions from one js file called global, but the article advised not to do this. Below is the code that should be used with inline javascript, called on the page that needs the function:
<script type="text/javascript>
mylib.article.init();
</script>
What I don't understand is the code below. The tutorial didn't go into any detail; what it is doing?
var mylib =
{
article_page :
{
init : function()
{
// Article page specific jQuery functions.
}
},
traffic_light :
{
init : function()
{
// Traffic light specific jQuery functions.
}
}
}