Remove coroutine from translate.js not supported in connector
From 7fc352b9
This commit is contained in:
parent
a853bb0661
commit
deb8503863
|
@ -1540,15 +1540,12 @@ Zotero.Translate.Base.prototype = {
|
||||||
* Saves items to the database, taking care to defer attachmentProgress notifications
|
* Saves items to the database, taking care to defer attachmentProgress notifications
|
||||||
* until after save
|
* until after save
|
||||||
*/
|
*/
|
||||||
_saveItems: Zotero.Promise.coroutine(function* (items) {
|
_saveItems: Zotero.Promise.method(function (items) {
|
||||||
var itemDoneEventsDispatched = false;
|
var itemDoneEventsDispatched = false;
|
||||||
var deferredProgress = [];
|
var deferredProgress = [];
|
||||||
var attachmentsWithProgress = [];
|
var attachmentsWithProgress = [];
|
||||||
|
|
||||||
try {
|
function attachmentCallback(attachment, progress, error) {
|
||||||
var newItems = yield this._itemSaver.saveItems(
|
|
||||||
items.slice(),
|
|
||||||
function (attachment, progress, error) {
|
|
||||||
var attachmentIndex = this._savingAttachments.indexOf(attachment);
|
var attachmentIndex = this._savingAttachments.indexOf(attachment);
|
||||||
if(progress === false || progress === 100) {
|
if(progress === false || progress === 100) {
|
||||||
if(attachmentIndex !== -1) {
|
if(attachmentIndex !== -1) {
|
||||||
|
@ -1568,17 +1565,9 @@ Zotero.Translate.Base.prototype = {
|
||||||
deferredProgress.push([attachment, progress, error]);
|
deferredProgress.push([attachment, progress, error]);
|
||||||
attachmentsWithProgress.push(attachment);
|
attachmentsWithProgress.push(attachment);
|
||||||
}
|
}
|
||||||
}.bind(this)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
catch (e) {
|
|
||||||
this._savingItems -= items.length;
|
|
||||||
Zotero.debug("REDUCING SAVING ITEMS ERROR TO " + this._savingItems);
|
|
||||||
Zotero.logError(e);
|
|
||||||
this.complete(false, e);
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return this._itemSaver.saveItems(items.slice(), attachmentCallback.bind(this)).then(function(newItems) {
|
||||||
// Remove attachments not being saved from item.attachments
|
// Remove attachments not being saved from item.attachments
|
||||||
for(var i=0; i<items.length; i++) {
|
for(var i=0; i<items.length; i++) {
|
||||||
var item = items[i];
|
var item = items[i];
|
||||||
|
@ -1607,6 +1596,12 @@ Zotero.Translate.Base.prototype = {
|
||||||
this._savingItems -= items.length;
|
this._savingItems -= items.length;
|
||||||
this.newItems = this.newItems.concat(newItems);
|
this.newItems = this.newItems.concat(newItems);
|
||||||
this._checkIfDone();
|
this._checkIfDone();
|
||||||
|
}.bind(this)).catch(function(e) {
|
||||||
|
this._savingItems -= items.length;
|
||||||
|
Zotero.debug("REDUCING SAVING ITEMS ERROR TO " + this._savingItems);
|
||||||
|
Zotero.logError(e);
|
||||||
|
this.complete(false, e);
|
||||||
|
}.bind(this));
|
||||||
}),
|
}),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue
Block a user