Changed extentsion of Request to mootools v1.2 format

git-svn-id: http://svn.zoneminder.com/svn/zm/trunk@2842 e3e1d417-86f3-4887-817a-d78f3d33393f
pull/27/merge
stan 2009-04-03 12:07:45 +00:00
parent 41f90e44ab
commit bc8ba5d490
1 changed files with 9 additions and 14 deletions

View File

@ -23,34 +23,29 @@ else
/*
* Ajax class extenstion to allow for request timeouts
*/
Request = Request.extend({
request: function( data )
Request.implement({
send: function( data )
{
if ( this.options.timeout )
{
if ( this.timeoutTimer )
{
this.removeTimer();
}
this.timeoutTimer = window.setTimeout( this.callTimeout.bindAsEventListener(this), this.options.timeout );
this.timeoutTimer = this.timedOut.delay( this.options.timeout, this );
this.addEvent( 'onComplete', this.removeTimer );
}
this.parent( data );
var sender = this.get('send');
sender.send( data );
return( this );
},
callTimeout: function ()
timedOut: function ()
{
this.transport.abort();
this.onFailure();
if ( this.options.onTimeout )
{
this.options.onTimeout();
}
this.cancel();
},
removeTimer: function()
{
window.clearTimeout( this.timeoutTimer );
$clear( this.timeoutTimer );
this.timeoutTimer = 0;
}
});