The function name is mixed even if I am using a namespace. In the below example when I call nwFunc.callMe()
or $.Test1.callTest()
it will execute _testFunction()
of doOneThing
. I am expected for $.Test1.callTest()
to call _testFunction()
in $.Test1
API instead of one in doOneThing
. What I need to do to correct it?
Example:
var doOneThing = function() {
_testFunction= function() {
...
}
return {
// public
callMe: function(){
_testFunction();
}
}
}
var nwFunc = doOneThing();
nwFunc.callMe();
$.Test1.callTest();
below is a example API
jQuery.Test1 = (function(){
_testFunction= function() {
...// do differently
}
return {
// public
callTest: function(){
_testFunction()
}
}
}(jQuery))