Skip to content

Commit 9fea4fe

Browse files
committed
conflictSearch is now aware of async nature of print()
1 parent 0829509 commit 9fea4fe

File tree

2 files changed

+13
-10
lines changed

2 files changed

+13
-10
lines changed

browser/modules/print.js

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -192,15 +192,17 @@ module.exports = {
192192
*
193193
*/
194194
print: (endEventName = "end:print", customData) => {
195-
state.bookmarkState(customData).then(response => {
196-
backboneEvents.get().trigger(endEventName, response);
197-
callBack(response.responseJSON);
198-
}).catch(response => {
199-
backboneEvents.get().trigger(endEventName, response);
200-
callBack(response.responseJSON);
195+
return new Promise((resolve, reject) => {
196+
state.bookmarkState(customData).then(response => {
197+
backboneEvents.get().trigger(endEventName, response);
198+
callBack(response.responseJSON);
199+
resolve();
200+
}).catch(response => {
201+
backboneEvents.get().trigger(endEventName, response);
202+
callBack(response.responseJSON);
203+
reject();
204+
});
201205
});
202-
203-
return true;
204206
},
205207

206208
/**

extensions/conflictSearch/browser/controller.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,9 @@ module.exports = {
8484
$("#conflict-get-print-fieldset").prop("disabled", true);
8585
$(this).button('loading');
8686
print.control(printC, scales, "_conflictPrint", "A4", "p", "inline");
87-
print.print(endPrintEventName, conflictSearch.getResult());
88-
print.cleanUp(true);
87+
print.print(endPrintEventName, conflictSearch.getResult()).then(() => {
88+
print.cleanUp(true);
89+
});
8990
});
9091

9192
// Click event for conflict search on/off toggle button

0 commit comments

Comments
 (0)