Skip to content

Commit

Permalink
save on Continue instead of on Run when skipRunSave is set
Browse files Browse the repository at this point in the history
  • Loading branch information
davidsbailey committed Sep 25, 2018
1 parent 0be2efa commit 0801f2c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
9 changes: 7 additions & 2 deletions apps/src/code-studio/initApp/project.js
Expand Up @@ -29,7 +29,8 @@ var events = {
// Fired when run state changes or we enter/exit design mode
appModeChanged: 'appModeChanged',
appInitialized: 'appInitialized',
workspaceChange: 'workspaceChange'
workspaceChange: 'workspaceChange',
continueButtonPressed: 'continueButtonPressed',
};

// Number of consecutive failed attempts to update the channel.
Expand Down Expand Up @@ -508,7 +509,11 @@ var projects = module.exports = {
this.setName('My Project');
}

$(window).on(events.appModeChanged, function (event, callback) {
const eventName = appOptions.level.skipRunSave ?
events.continueButtonPressed :
events.appModeChanged;

$(window).on(eventName, function (event, callback) {
this.saveIfSourcesChanged().then(callback);
}.bind(this));

Expand Down
6 changes: 5 additions & 1 deletion apps/src/feedback.js
Expand Up @@ -203,7 +203,11 @@ FeedbackUtils.prototype.displayFeedback = function (options, requiredBlocks,
};

const onContinue = () => {
options.onContinue();
if (options.level.skipRunSave) {
$(window).trigger('continueButtonPressed', options.onContinue);
} else {
options.onContinue();
}
};

var onHidden = onlyContinue ? onContinue : function () {
Expand Down

0 comments on commit 0801f2c

Please sign in to comment.