У меня есть следующий объект js:
var livePage = {
delay: 1000,
loadTables: function(){
loadTable($("#vbeTable"),'getUpdateA')
loadTable($("#vbcTable"),'getUpdateB')
createAlertDialog();
},
setClicks: function(){
$(".expand").live('click',function(){
expand($(this).attr('expandvalue'));
})
$( ".launch" )
.click(function(){
newPopup('index.php',1120,550);
});
$('.edit').live('click',function(){
openColPick($(this).attr('colType'))
});
},
setRightClick: function(){
$('body').contextMenu('mainmenu', {
bindings: {
'o_o': function(t) {
thePopupWindowsMain('oo','','',220,150,'right','');
},
'o_h': function(t) {
thePopupWindowsMain('oh','','',285,385,'left','');
},
'launch_prog': function(t) {
$(".launch").click();
},
'logout': function(t){
window.top.location = 'logout.php';
}
}
});
},
setWindow: function(){
$(window)
.resize(function() {
$('body').css('height', $(this).height())
alertToCorner();
})
.scroll(function(){$(this).resize()});
$(window).resize();
},
checkLogout: function(){
$.ajax({
url: 'getLogin.php',
dataType: "html",
success: function(data){
if($.trim(data) == 'LOGOUT'){
window.location = 'logout.php';
}
},
complete: function(){
setTimeout( function () {
livePage.checkLogout();},
livePage.delay)
},
timeout: 2000
});
},
init: function(){
this.checkLogout();
this.loadTables();
this.setClicks();
this.setRightClick();
this.setWindow();
console.log(this);
}
}
По какой-то причине в checkLogout: function()
мне приходится использовать livePage.delay
и livePage.checkLogout()
Когда я пытаюсь использовать, например, this.checklogout()
, я получаю следующую ошибку в консоли Chrome:
Uncaught TypeError: Object [object
DOMWindow] не имеет метода 'checkLogout'
Как мне это исправить?
Спасибо!