Я использую this ASP.Net/jQuery session timeout control. Отлично работает, но мне нужно получить доступ к одному из его javascript-методов из какого-то другого места, кроме диалогового окна jQuery. Вот фрагмент кода, который я хочу, чтобы получить доступ к:Как вызвать метод Javascript (вне области?)
TSC.Timeout.Timeout.prototype =
{
// THE METHOD I WANT TO CALL: _resetTimeout()
_resetTimeout: function (e) {
// modify timeout to do jquery dialog
if (typeof jQuery.ui == 'undefined')
$get(this._clientId).style.display = 'none';
clearTimeout(this._timerAboutToTimeout);
clearTimeout(this._timerTimeout);
clearTimeout(this._timerCountDown);
this._showAboutToTimeoutDelegate = Function.createDelegate(this, this.showAboutToTimeout);
this._timerAboutToTimeout = setTimeout(this._showAboutToTimeoutDelegate, this._aboutToTimeoutMinutes * 5 * 1000); //TODO: Change this back to 60
this._timeoutDelegate = Function.createDelegate(this, this.timeout);
this._timerTimeout = setTimeout(this._timeoutDelegate, this._timeoutMinutes * 10 * 1000); //TODO: Change this back to 60
},
// HOW IT'S BEING CALLED FROM WITHIN THE JS OBJECT:
initDialog: function (e) {
// modify timeout to do jquery dialog
if (typeof jQuery.ui != 'undefined') {
var tsc = this;
$("#" + this._clientId).dialog({
autoOpen: false,
width: 500,
resizeable: false,
bgiframe: true,
modal: true,
position: 'center',
buttons: {
"Keep Me Signed In": function() {
$(this).dialog('close');
CallServer();
tsc._resetTimeout();
}
}
});
}
}
}
Я не могу показаться, чтобы получить _resetTimeout()
работать с консоли. Вызов TSC.Timeout.Timeout.prototype._resetTimeout();
дает следующие ошибки:
Uncaught TypeError: Cannot read property 'length' of undefined
TSC.Timeout.Timeout.showAboutToTimeoutWebResource.axd:200
(anonymous function)ScriptResource.axd:47
WebResource.axd:217Uncaught TypeError: Cannot read property 'length' of undefined
TSC.Timeout.Timeout.timeoutWebResource.axd:217
(anonymous function)ScriptResource.axd:47
WebResource.axd:213Uncaught TypeError: Property 'focus' of object [object DOMWindow] is not a function
TSC.Timeout.Timeout.showAboutToTimeoutWebResource.axd:213
(anonymous function)
Любые идеи, как я могу назвать этот метод?