How do I tell when a download has completed using the chrome downloads api in the background script? I have the following code:
chrome.downloads.onChanged.addListener((downloadDelta)=>{
handleDownloadOnChange(downloadDelta);
return true;
});
export const handleDownloadOnChange = async (downloadDelta: chrome.downloads.DownloadDelta) =>{
if (downloadDelta.state === 'complete') {
if(downloadDelta.url !==undefined){
console.log('download complete');
}
}
};
However, the state property of the the downloadDelta property is never filled out so Im not sure how tell if the item is done or not.