mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-06-28 00:40:07 +02:00
removed global state store :D
This commit is contained in:
parent
82c3e75394
commit
7ac30e897f
3 changed files with 6 additions and 21 deletions
|
@ -1,5 +1,4 @@
|
||||||
var _ = require('underscore');
|
var _ = require('underscore');
|
||||||
var Backbone = require('backbone');
|
|
||||||
var Q = require('q');
|
var Q = require('q');
|
||||||
|
|
||||||
var util = require('../util');
|
var util = require('../util');
|
||||||
|
@ -9,13 +8,10 @@ var log = require('../log');
|
||||||
|
|
||||||
var Errors = require('../util/errors');
|
var Errors = require('../util/errors');
|
||||||
var Sandbox = require('../sandbox/').Sandbox;
|
var Sandbox = require('../sandbox/').Sandbox;
|
||||||
var Constants = require('../util/constants');
|
var GlobalStateActions = require('../actions/GlobalStateActions');
|
||||||
var GlobalState = require('../util/globalState');
|
|
||||||
|
|
||||||
var Visualization = require('../visuals/visualization').Visualization;
|
var Visualization = require('../visuals/visualization').Visualization;
|
||||||
var ParseWaterfall = require('../level/parseWaterfall').ParseWaterfall;
|
|
||||||
var DisabledMap = require('../level/disabledMap').DisabledMap;
|
var DisabledMap = require('../level/disabledMap').DisabledMap;
|
||||||
var Command = require('../models/commandModel').Command;
|
|
||||||
var GitShim = require('../git/gitShim').GitShim;
|
var GitShim = require('../git/gitShim').GitShim;
|
||||||
var Commands = require('../commands');
|
var Commands = require('../commands');
|
||||||
|
|
||||||
|
@ -442,7 +438,7 @@ var Level = Sandbox.extend({
|
||||||
'echo "level solved!"'
|
'echo "level solved!"'
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
GlobalState.isAnimating = true;
|
GlobalStateActions.changeIsAnimating(true);
|
||||||
finishAnimationChain = this.mainVis.gitVisuals.finishAnimation();
|
finishAnimationChain = this.mainVis.gitVisuals.finishAnimation();
|
||||||
if (this.mainVis.originVis) {
|
if (this.mainVis.originVis) {
|
||||||
finishAnimationChain = finishAnimationChain.then(
|
finishAnimationChain = finishAnimationChain.then(
|
||||||
|
@ -479,7 +475,7 @@ var Level = Sandbox.extend({
|
||||||
// nothing to do, we will just close
|
// nothing to do, we will just close
|
||||||
})
|
})
|
||||||
.done(function() {
|
.done(function() {
|
||||||
GlobalState.isAnimating = false;
|
GlobalStateActions.changeIsAnimating(false);
|
||||||
defer.resolve();
|
defer.resolve();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,11 +0,0 @@
|
||||||
/**
|
|
||||||
* Random grab bag of global state variables so we
|
|
||||||
* dont just straight up use window
|
|
||||||
*/
|
|
||||||
|
|
||||||
var GlobalState = {
|
|
||||||
flipTreeY: false,
|
|
||||||
isAnimating: false
|
|
||||||
};
|
|
||||||
|
|
||||||
module.exports = GlobalState;
|
|
|
@ -1,7 +1,7 @@
|
||||||
var _ = require('underscore');
|
var _ = require('underscore');
|
||||||
var Q = require('q');
|
var Q = require('q');
|
||||||
var Backbone = require('backbone');
|
var Backbone = require('backbone');
|
||||||
var GlobalState = require('../../util/globalState');
|
var GlobalStateActions = require('../actions/GlobalStateActions');
|
||||||
var GRAPHICS = require('../../util/constants').GRAPHICS;
|
var GRAPHICS = require('../../util/constants').GRAPHICS;
|
||||||
|
|
||||||
var Animation = Backbone.Model.extend({
|
var Animation = Backbone.Model.extend({
|
||||||
|
@ -67,13 +67,13 @@ var AnimationQueue = Backbone.Model.extend({
|
||||||
this.set('index', 0);
|
this.set('index', 0);
|
||||||
|
|
||||||
// set the global lock that we are animating
|
// set the global lock that we are animating
|
||||||
GlobalState.isAnimating = true;
|
GlobalStateActions.changeIsAnimating(true);
|
||||||
this.next();
|
this.next();
|
||||||
},
|
},
|
||||||
|
|
||||||
finish: function() {
|
finish: function() {
|
||||||
// release lock here
|
// release lock here
|
||||||
GlobalState.isAnimating = false;
|
GlobalStateActions.changeIsAnimating(false);
|
||||||
this.get('callback')();
|
this.get('callback')();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue