W3cubDocs

/Web APIs

ProgressEvent: ProgressEvent() constructor

The ProgressEvent() constructor returns a new ProgressEvent object, representing the current completion of a long process.

Syntax

js

new ProgressEvent(type)
new ProgressEvent(type, options)

Parameters

type

A string with the name of the event. It is case-sensitive and browsers set it to loadstart, progress, abort, error, load, timeout, or loadend.

options Optional

An object that, in addition of the properties defined in Event(), can have the following properties:

lengthComputable Optional

A boolean value indicating if the total work to be done, and the amount of work already done, by the underlying process is calculable. In other words, it tells if the progress is measurable or not. It defaults to false.

loaded Optional

A number representing the amount of work already performed by the underlying process. The ratio of work done can be calculated with the property and ProgressEvent.total. When downloading a resource using HTTP, this only represent the part of the content itself, not headers and other overhead. It defaults to 0.

total Optional

A number representing the total amount of work that the underlying process is in the progress of performing. When downloading a resource using HTTP, this only represent the content itself, not headers and other overhead. It defaults to 0.

Return value

A new ProgressEvent object.

Specifications

Browser compatibility

Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari WebView Android Chrome Android Firefox for Android Opera Android Safari on IOS Samsung Internet
ProgressEvent 16 14 18 No ≤12.1 6 4.4 18 18 ≤12.1 6 1.0

See also

© 2005–2023 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/ProgressEvent/ProgressEvent