CIRCDCCFileTransfer.onProgress Member
Syntax
object.onProgress(e);
Arguments
Argument | Summary |
---|---|
e |
Returns
Remarks
See Also
Source Code
function my_dccfileprogress(e)
{
var now = new Date();
var pcent = this.progress;
var tab = getTabForObject(this);
// If we've moved 100KiB or waited 10s, update the progress bar.
if ((this.position > this._lastPosition + 102400) ||
(now - this._lastUpdate > 10000))
{
updateProgress();
updateTitle();
if (tab)
tab.setAttribute("label", this.viewName + " (" + pcent + "%)");
var change = (this.position - this._lastPosition);
var speed = change / ((now - this._lastSpeedTime) / 1000); // B/s
this._lastSpeedTime = now;
/* Use an average of the last speed, and this speed, so we get a little
* smoothing to it.
*/
this.speed = (this.speed + speed) / 2;
this.updateHeader();
this._lastPosition = this.position;
}
// If it's also been 10s or more since we last displayed a msg...
if (now - this._lastUpdate > 10000)
{
this._lastUpdate = now;
var args = [pcent, getSISize(this.position), getSISize(this.size),
getSISpeed(this.speed)];
// We supress this message if the view is hidden.
if (tab)
this.displayHere(getMsg(MSG_DCCFILE_PROGRESS, args), "DCC-FILE");
}
}