downloads.onChanged

When any of a downloads.DownloadItem's properties except bytesReceived changes, this event fires with the downloadId and an object containing the properties that changed.

Syntax

browser.downloads.onChanged.addListener(function(
  downloadDelta // object
) {...})
browser.downloads.onChanged.removeListener(listener)
browser.downloads.onChanged.hasListener(listener)

Events have three functions:

addListener(callback)
Adds a listener to this event.
removeListener(listener)
Stop listening to this event. The listener argument is the listener to remove.
hasListener(listener)
Check whether listener is registered for this event. Returns true if it is listening, false otherwise.

addListener syntax

Parameters

callback

Function that will be called when this event occurs. The function will be passed the following arguments:

downloadDelta
object.

Additional objects

downloadDelta

id
integer. The id of the downloads.DownloadItem that changed.
urlOptional
downloads.StringDelta. Describes a change in a downloads.DownloadItem's url.
filenameOptional
downloads.StringDelta. Describes a change in a downloads.DownloadItem's filename.
dangerOptional
downloads.StringDelta. Describes a change in a downloads.DownloadItem's danger.
mimeOptional
downloads.StringDelta. Describes a change in a downloads.DownloadItem's mime.
startTimeOptional
downloads.StringDelta. Describes a change in a downloads.DownloadItem's startTime.
endTimeOptional
downloads.StringDelta. Describes a change in a downloads.DownloadItem's endTime.
stateOptional
downloads.StringDelta. Describes a change in a downloads.DownloadItem's state.
canResumeOptional
downloads.BooleanDelta.
pausedOptional
downloads.BooleanDelta. Describes a change in a downloads.DownloadItem's paused.
errorOptional
downloads.StringDelta. Describes a change in a downloads.DownloadItem's error.
totalBytesOptional
downloads.DoubleDelta. Describes a change in a downloads.DownloadItem's totalBytes.
fileSizeOptional
downloads.DoubleDelta. Describes a change in a downloads.DownloadItem's fileSize.
existsOptional
downloads.BooleanDelta.

Browser compatibility

EdgeFirefoxChromeOpera
Basic support?47.0Yes33
Firefox
Basic support48.0

Examples

Acknowledgements

This API is based on Chromium's chrome.downloads API.

Document Tags and Contributors

 Contributors to this page: wbamberg
 Last updated by: wbamberg,