Skip to content

Commit

Permalink
Fixed results not being used when popping dialogs
Browse files Browse the repository at this point in the history
Fixes #66
  • Loading branch information
ThaumRystra committed May 11, 2017
1 parent cdae75b commit abcfe57
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,23 @@ pushDialogStack = function({template, data, element, returnElement, callback}){
updateHistory();
};

var currentResult;

popDialogStack = function(result){
if (history && history.state && history.state.openDialogs){
currentResult = result;
history.back();
} else {
popDialogStackAction();
popDialogStackAction(result);
}
}

window.onpopstate = function(event){
let state = event.state;
let numDialogs = dialogs._array.length;
if (_.isFinite(state.openDialogs) && numDialogs > state.openDialogs){
popDialogStackAction();
popDialogStackAction(currentResult);
currentResult = undefined;
}
}

Expand Down

0 comments on commit abcfe57

Please sign in to comment.