mirror of
https://github.com/zotero/zotero.git
synced 2026-09-29 01:41:24 +00:00
Migrate Zotero.Promise#cancel() in zoteroPane.js
This commit is contained in:
parent
1f87ba2a24
commit
232d5e7ac2
1 changed files with 11 additions and 20 deletions
|
|
@ -1394,10 +1394,9 @@ var ZoteroPane = new function () {
|
|||
let row = this.getCollectionTreeRow();
|
||||
if (!row || !row.isFeedsOrFeed()) return;
|
||||
this.toggleSelectedItemsRead();
|
||||
if (itemReadPromise) {
|
||||
// FIXME: fx140: replace call to Zotero.Promise instance method 'cancel()'
|
||||
itemReadPromise.cancel();
|
||||
itemReadPromise = null;
|
||||
if (itemReadTimeout) {
|
||||
clearTimeout(itemReadTimeout);
|
||||
itemReadTimeout = null;
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
@ -6348,18 +6347,17 @@ var ZoteroPane = new function () {
|
|||
}
|
||||
};
|
||||
|
||||
var itemReadPromise;
|
||||
var itemReadTimeout = null;
|
||||
this.startItemReadTimeout = function (feedItemID) {
|
||||
if (itemReadPromise) {
|
||||
// FIXME: fx140: replace call to Zotero.Promise instance method 'cancel()'
|
||||
itemReadPromise.cancel();
|
||||
if (itemReadTimeout) {
|
||||
clearTimeout(itemReadTimeout);
|
||||
itemReadTimeout = null;
|
||||
}
|
||||
|
||||
const FEED_READ_TIMEOUT = 1000;
|
||||
|
||||
itemReadPromise = Zotero.Promise.delay(FEED_READ_TIMEOUT)
|
||||
.then(async function () {
|
||||
itemReadPromise = null;
|
||||
itemReadTimeout = setTimeout(async () => {
|
||||
itemReadTimeout = null;
|
||||
|
||||
// Check to make sure we're still on the same item
|
||||
var items = this.getSelectedItems();
|
||||
|
|
@ -6376,15 +6374,8 @@ var ZoteroPane = new function () {
|
|||
|
||||
await feedItem.toggleRead(true);
|
||||
this.itemPane.setReadLabel(true);
|
||||
}.bind(this))
|
||||
.catch(function (e) {
|
||||
if (e instanceof Zotero.Promise.CancellationError) {
|
||||
Zotero.debug(e.message);
|
||||
return;
|
||||
}
|
||||
Zotero.logError(e);
|
||||
});
|
||||
}
|
||||
}, FEED_READ_TIMEOUT);
|
||||
};
|
||||
|
||||
|
||||
function reportErrors() {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue