I've a question regarding a piece of javascript code I'm working on. In another question on stackoverflow I've read that you can do this.method1 from method2 inside an object. However, when doing that 'this' points to the current window object and method1 (naturally) cannot be found.
Please advise me on how to best fix this issue.
The error I get is:
TypeError: this.initFB is not a function
this.initFB();
The code:
var FPPL = {
/** Variables */
larvaunched : false,
/**
*
*/
initFB : function(){
if ((typeof(FB)!= 'undefined')) {
FB.init({
xfbml: true,
status : true, // check login status
cookie : true // enable cookies to allow the server to access the session
});
}
},
initCode : function(){
console.log(this);
this.initFB();
if (!this.checkForLaunch())
return false;
window.setTimeout(this.showFaceBox, lb_l_ret.delay);
}
....
}
window.fbAsyncInit = FPPL.initCode;