Sha256: ce8ce9c470d1657182770cf841b1a4559949316a8f411b6c443fb1214367ca0f
Contents?: true
Size: 1.43 KB
Versions: 63
Compression:
Stored size: 1.43 KB
Contents
/* RSence * Copyright 2009 Riassence Inc. * http://riassence.com/ * * You should have received a copy of the GNU General Public License along * with this software package. If not, contact licensing@riassence.com */ /*** = Description ** The single instance of this class is constructed after the first ** handshake request with the server by the 'main' plugin. ** ** It has dual functionality: ** - It tells the the client time. ** It's available as the server HValue instance ** +msg.session[:main][:client_time]+ from ** any Plugin instance. ** - It polls the server on regular intervals. ** The polling interval is defined by the server ** as the _timeoutSecs constructor parameter. ** ***/ //var//RSence.COMM COMM.SessionWatcher = HApplication.extend({ constructor: function( _timeoutSecs, _sesTimeoutValueId ){ // gets the HValue represented by // sesTimeoutValueId (:client_time in server) this.sesTimeoutValue = COMM.Values.values[_sesTimeoutValueId]; this.timeoutSecs = _timeoutSecs; // onIdle is called when HSystem's ticker count % 100 == 0 // this means it's 5 seconds with HSystemTickerInterval 50 this.base(10, 'SesWatcher'); }, // Tells the server the client's current time onIdle: function(){ var now = new Date().getTime(); if((now - this.sesTimeoutValue.value) > this.timeoutSecs ){ this.sesTimeoutValue.set( now ); } } });
Version data entries
63 entries across 63 versions & 2 rubygems