mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-07-13 08:04:27 +02:00
collection no longer global
This commit is contained in:
parent
94db9a3c7d
commit
4994015bab
3 changed files with 11 additions and 7 deletions
|
@ -7,13 +7,13 @@ var uniqueId = (function() {
|
||||||
};
|
};
|
||||||
})();
|
})();
|
||||||
|
|
||||||
function GitEngine() {
|
function GitEngine(options) {
|
||||||
this.rootCommit = null;
|
this.rootCommit = null;
|
||||||
this.refs = {};
|
this.refs = {};
|
||||||
this.HEAD = null;
|
this.HEAD = null;
|
||||||
this.id_gen = 0;
|
this.id_gen = 0;
|
||||||
this.branches = [];
|
this.branches = [];
|
||||||
this.collection = commitCollection;
|
this.collection = options.collection;
|
||||||
|
|
||||||
// global variable to keep track of the options given
|
// global variable to keep track of the options given
|
||||||
// along with the command call.
|
// along with the command call.
|
||||||
|
@ -28,7 +28,7 @@ function GitEngine() {
|
||||||
GitEngine.prototype.init = function() {
|
GitEngine.prototype.init = function() {
|
||||||
// make an initial commit and a master branch
|
// make an initial commit and a master branch
|
||||||
this.rootCommit = new Commit({rootCommit: true});
|
this.rootCommit = new Commit({rootCommit: true});
|
||||||
commitCollection.add(this.rootCommit);
|
this.collection.add(this.rootCommit);
|
||||||
|
|
||||||
this.refs[this.rootCommit.get('id')] = this.rootCommit;
|
this.refs[this.rootCommit.get('id')] = this.rootCommit;
|
||||||
|
|
||||||
|
|
|
@ -34,8 +34,12 @@ $(document).ready(function(){
|
||||||
collection: commandCollection
|
collection: commandCollection
|
||||||
});
|
});
|
||||||
|
|
||||||
gitEngine = new GitEngine();
|
gitEngine = new GitEngine({
|
||||||
gitVisuals = new GitVisuals();
|
collection: commitCollection
|
||||||
|
});
|
||||||
|
gitVisuals = new GitVisuals({
|
||||||
|
collection: commitCollection
|
||||||
|
});
|
||||||
|
|
||||||
$('#commandTextField').focus();
|
$('#commandTextField').focus();
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
function GitVisuals() {
|
function GitVisuals(options) {
|
||||||
this.collection = commitCollection;
|
this.collection = options.collection;
|
||||||
|
|
||||||
this.collection.on('change', _.bind(this.collectionChanged, this));
|
this.collection.on('change', _.bind(this.collectionChanged, this));
|
||||||
events.on('drawGitVisuals', _.bind(this.drawVisuals, this));
|
events.on('drawGitVisuals', _.bind(this.drawVisuals, this));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue