mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-06-30 09:44:26 +02:00
yay better
This commit is contained in:
parent
b1427556ef
commit
2fb843a8d6
3 changed files with 34 additions and 33 deletions
|
@ -46,7 +46,7 @@ var MultiView = Backbone.View.extend({
|
|||
markdown: 'Im second'
|
||||
}
|
||||
}];
|
||||
this.deferred = options.deferred;
|
||||
this.deferred = Q.defer();
|
||||
|
||||
this.childViews = [];
|
||||
this.currentIndex = 0;
|
||||
|
@ -68,6 +68,10 @@ var MultiView = Backbone.View.extend({
|
|||
this.start();
|
||||
},
|
||||
|
||||
getPromise: function() {
|
||||
return this.deferred.promise;
|
||||
},
|
||||
|
||||
getPosFunc: function() {
|
||||
return _.debounce(_.bind(function() {
|
||||
this.navForward();
|
||||
|
@ -113,13 +117,12 @@ var MultiView = Backbone.View.extend({
|
|||
},
|
||||
|
||||
finish: function() {
|
||||
// first we stop listening to keyboard and give that back to UI, which
|
||||
// other views will take if they need to
|
||||
this.keyboardListener.mute();
|
||||
if (this.deferred) {
|
||||
this.deferred.resolve();
|
||||
} else {
|
||||
console.warn('no promise to resolve');
|
||||
require('../app').getUI().modalEnd();
|
||||
}
|
||||
require('../app').getUI().modalEnd();
|
||||
this.deferred.resolve();
|
||||
|
||||
setTimeout(_.bind(function() {
|
||||
_.each(this.childViews, function(childView) {
|
||||
childView.tearDown();
|
||||
|
@ -128,11 +131,8 @@ var MultiView = Backbone.View.extend({
|
|||
},
|
||||
|
||||
start: function() {
|
||||
require('../app').getUI().modalStart();
|
||||
this.showViewIndex(this.currentIndex);
|
||||
if (!this.deferred) {
|
||||
console.warn('not part of a promise chain');
|
||||
require('../app').getUI().modalStart();
|
||||
}
|
||||
},
|
||||
|
||||
createChildView: function(viewJSON) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue