The reason the function is not defined in your namespace is due to the strings
return
{
myPublicMethod:myPublicMethod
}
After the return, a semicolon is inserted, so what the interpreter sees, actually looks something like this:
return;
{
myPublicMethod:myPublicMethod
}
, , myNamespace undefined. : , return:
return {
myPublicMethod: myPublicMethod
};
( , , , - - minifier)
.
var myNamespace = (function() {
...
})();