mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-07-01 02:04:26 +02:00
yay better
This commit is contained in:
parent
b1427556ef
commit
2fb843a8d6
3 changed files with 34 additions and 33 deletions
|
@ -13785,7 +13785,7 @@ var MultiView = Backbone.View.extend({
|
||||||
markdown: 'Im second'
|
markdown: 'Im second'
|
||||||
}
|
}
|
||||||
}];
|
}];
|
||||||
this.deferred = options.deferred;
|
this.deferred = Q.defer();
|
||||||
|
|
||||||
this.childViews = [];
|
this.childViews = [];
|
||||||
this.currentIndex = 0;
|
this.currentIndex = 0;
|
||||||
|
@ -13807,6 +13807,10 @@ var MultiView = Backbone.View.extend({
|
||||||
this.start();
|
this.start();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
getPromise: function() {
|
||||||
|
return this.deferred.promise;
|
||||||
|
},
|
||||||
|
|
||||||
getPosFunc: function() {
|
getPosFunc: function() {
|
||||||
return _.debounce(_.bind(function() {
|
return _.debounce(_.bind(function() {
|
||||||
this.navForward();
|
this.navForward();
|
||||||
|
@ -13852,13 +13856,12 @@ var MultiView = Backbone.View.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
finish: function() {
|
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();
|
this.keyboardListener.mute();
|
||||||
if (this.deferred) {
|
require('../app').getUI().modalEnd();
|
||||||
this.deferred.resolve();
|
this.deferred.resolve();
|
||||||
} else {
|
|
||||||
console.warn('no promise to resolve');
|
|
||||||
require('../app').getUI().modalEnd();
|
|
||||||
}
|
|
||||||
setTimeout(_.bind(function() {
|
setTimeout(_.bind(function() {
|
||||||
_.each(this.childViews, function(childView) {
|
_.each(this.childViews, function(childView) {
|
||||||
childView.tearDown();
|
childView.tearDown();
|
||||||
|
@ -13867,11 +13870,8 @@ var MultiView = Backbone.View.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
start: function() {
|
start: function() {
|
||||||
|
require('../app').getUI().modalStart();
|
||||||
this.showViewIndex(this.currentIndex);
|
this.showViewIndex(this.currentIndex);
|
||||||
if (!this.deferred) {
|
|
||||||
console.warn('not part of a promise chain');
|
|
||||||
require('../app').getUI().modalStart();
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
createChildView: function(viewJSON) {
|
createChildView: function(viewJSON) {
|
||||||
|
@ -17282,7 +17282,7 @@ var MultiView = Backbone.View.extend({
|
||||||
markdown: 'Im second'
|
markdown: 'Im second'
|
||||||
}
|
}
|
||||||
}];
|
}];
|
||||||
this.deferred = options.deferred;
|
this.deferred = Q.defer();
|
||||||
|
|
||||||
this.childViews = [];
|
this.childViews = [];
|
||||||
this.currentIndex = 0;
|
this.currentIndex = 0;
|
||||||
|
@ -17304,6 +17304,10 @@ var MultiView = Backbone.View.extend({
|
||||||
this.start();
|
this.start();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
getPromise: function() {
|
||||||
|
return this.deferred.promise;
|
||||||
|
},
|
||||||
|
|
||||||
getPosFunc: function() {
|
getPosFunc: function() {
|
||||||
return _.debounce(_.bind(function() {
|
return _.debounce(_.bind(function() {
|
||||||
this.navForward();
|
this.navForward();
|
||||||
|
@ -17349,13 +17353,12 @@ var MultiView = Backbone.View.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
finish: function() {
|
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();
|
this.keyboardListener.mute();
|
||||||
if (this.deferred) {
|
require('../app').getUI().modalEnd();
|
||||||
this.deferred.resolve();
|
this.deferred.resolve();
|
||||||
} else {
|
|
||||||
console.warn('no promise to resolve');
|
|
||||||
require('../app').getUI().modalEnd();
|
|
||||||
}
|
|
||||||
setTimeout(_.bind(function() {
|
setTimeout(_.bind(function() {
|
||||||
_.each(this.childViews, function(childView) {
|
_.each(this.childViews, function(childView) {
|
||||||
childView.tearDown();
|
childView.tearDown();
|
||||||
|
@ -17364,11 +17367,8 @@ var MultiView = Backbone.View.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
start: function() {
|
start: function() {
|
||||||
|
require('../app').getUI().modalStart();
|
||||||
this.showViewIndex(this.currentIndex);
|
this.showViewIndex(this.currentIndex);
|
||||||
if (!this.deferred) {
|
|
||||||
console.warn('not part of a promise chain');
|
|
||||||
require('../app').getUI().modalStart();
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
createChildView: function(viewJSON) {
|
createChildView: function(viewJSON) {
|
||||||
|
|
|
@ -46,7 +46,7 @@ var MultiView = Backbone.View.extend({
|
||||||
markdown: 'Im second'
|
markdown: 'Im second'
|
||||||
}
|
}
|
||||||
}];
|
}];
|
||||||
this.deferred = options.deferred;
|
this.deferred = Q.defer();
|
||||||
|
|
||||||
this.childViews = [];
|
this.childViews = [];
|
||||||
this.currentIndex = 0;
|
this.currentIndex = 0;
|
||||||
|
@ -68,6 +68,10 @@ var MultiView = Backbone.View.extend({
|
||||||
this.start();
|
this.start();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
getPromise: function() {
|
||||||
|
return this.deferred.promise;
|
||||||
|
},
|
||||||
|
|
||||||
getPosFunc: function() {
|
getPosFunc: function() {
|
||||||
return _.debounce(_.bind(function() {
|
return _.debounce(_.bind(function() {
|
||||||
this.navForward();
|
this.navForward();
|
||||||
|
@ -113,13 +117,12 @@ var MultiView = Backbone.View.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
finish: function() {
|
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();
|
this.keyboardListener.mute();
|
||||||
if (this.deferred) {
|
require('../app').getUI().modalEnd();
|
||||||
this.deferred.resolve();
|
this.deferred.resolve();
|
||||||
} else {
|
|
||||||
console.warn('no promise to resolve');
|
|
||||||
require('../app').getUI().modalEnd();
|
|
||||||
}
|
|
||||||
setTimeout(_.bind(function() {
|
setTimeout(_.bind(function() {
|
||||||
_.each(this.childViews, function(childView) {
|
_.each(this.childViews, function(childView) {
|
||||||
childView.tearDown();
|
childView.tearDown();
|
||||||
|
@ -128,11 +131,8 @@ var MultiView = Backbone.View.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
start: function() {
|
start: function() {
|
||||||
|
require('../app').getUI().modalStart();
|
||||||
this.showViewIndex(this.currentIndex);
|
this.showViewIndex(this.currentIndex);
|
||||||
if (!this.deferred) {
|
|
||||||
console.warn('not part of a promise chain');
|
|
||||||
require('../app').getUI().modalStart();
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
createChildView: function(viewJSON) {
|
createChildView: function(viewJSON) {
|
||||||
|
|
1
todo.txt
1
todo.txt
|
@ -36,6 +36,7 @@ Big Bugs to fix:
|
||||||
Done things:
|
Done things:
|
||||||
(I only started this on Dec 17th 2012 to get a better sense of what was done)
|
(I only started this on Dec 17th 2012 to get a better sense of what was done)
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
[x] change to returning a promise for multiview
|
||||||
[x] multiViews with multiple terminals...
|
[x] multiViews with multiple terminals...
|
||||||
[x] debounce the forward and back methods
|
[x] debounce the forward and back methods
|
||||||
[x] multiview makes all these arrow views which fire events
|
[x] multiview makes all these arrow views which fire events
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue