I'm creating a small library of oft-used functions and want to refer to them within my namespace using the this keyword - searching has produced many different conflicting suggestions, tips and syntax. My structure looks like this:
var LibraryName = {
someValue: 0,
firstFunc: function(stuff) {
LibraryName.someValue = 99;
LibraryName.secondFunction();
},
secondFunction: function() {
LibraryName.doSomething(LibraryName.someValue);
}
}
So what I'm wondering is, do I have to refer to the full function name inside my namespace or can I use the keyword 'this' - I tried:
var LibraryName = {
someValue: 0,
firstFunc: function(stuff) {
this.someValue = 99;
this.secondFunction();
},
secondFunction: function() {
this.doSomething(this.someValue);
}
}
But I got errors stating that:
Uncaught TypeError: undefined is not a function
Thanks in advance!