Ive been using this way of defining a namespace
(function( skillet, $, undefined ) {
//Private Property
var isHot = true;
//Public Property
skillet.ingredient = "Bacon Strips";
//Public Method
skillet.fry = function() {
var oliveOil;
addItem( "\t\n Butter \n\t" );
addItem( oliveOil );
console.log( "Frying " + skillet.ingredient );
};
//Private Method
function addItem( item ) {
if ( item !== undefined ) {
console.log( "Adding " + $.trim(item) );
}
}
}( window.skillet = window.skillet || {}, jQuery ));
Now Id like to extend skillet to a sub namespace, like skillet.module and let module behave in the same way as skillet - protect its undefined, and allow private and public members.
Ive tried the other way of defining a namespace, inside skillet, do skillet.theObject = { blah: function() {} }; and so on but that only gives me a normal object and not private and public members in it.