function onRemoved() {
console.log(`Removed item`);
}
function onError(error) {
console.log(`Error: ${error}`);
}
function remove(downloadItems) {
if (downloadItems.length > 0) {
let removing = browser.downloads.removeFile(downloadItems[0].id);
removing.then(onRemoved, onError);
}
}
let searching = browser.downloads.search({
limit: 1,
orderBy: ["-startTime"],
});
searching.then(remove, onError);downloads.removeFile() / notebook
downloads.removeFile()
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.