非标
此特征是非标准的,且不在标准轨道中。不要在面向 Web 的生产站点中使用它:它不适用于每个用户。实现之间可能存在大的不兼容性,且行为将来可能改变。

摘要

This property specifies a callback function to be run repeatedly while the operation represented by a FileRequest object is in progress.

句法

instanceOfFileRequest.onprogress = function;
					

Where instanceOfFileRequest 是 FileRequest object and function is the JavaScript function to execute.

Each time the function callback is called, it gets an object as its first parameter. Those objects contain two properties:

loaded

A number representing the current amount of bytes processed by the operation.

total

A number representing the total amount of bytes that will be processed by the operation.

范例

// Assuming 'request' which is a FileRequest object
request.onprogress = function (status) {
  var progress = document.querySelector('progress');
  progress.value = status.loaded;
  progress.max   = status.total;
}
					

规范

Not part of any current specification.

另请参阅

元数据

  • 最后修改: