diff --git a/src/js/app/index.js b/src/js/app/index.js index e087ee58..f79d695c 100644 --- a/src/js/app/index.js +++ b/src/js/app/index.js @@ -21,6 +21,8 @@ var events = assign( } } ); +// Allow unlimited listeners, so FF doesnt break +events.setMaxListeners(0); var commandUI; var sandbox; var eventBaton; diff --git a/src/js/visuals/index.js b/src/js/visuals/index.js index fef05ffc..f7a274ef 100644 --- a/src/js/visuals/index.js +++ b/src/js/visuals/index.js @@ -39,10 +39,10 @@ function GitVisuals(options) { this.branchCollection.on('add', this.addBranchFromEvent, this); this.branchCollection.on('remove', this.removeBranch, this); - + this.tagCollection.on('add', this.addTagFromEvent, this); this.tagCollection.on('remove', this.removeTag, this); - + this.deferred = []; this.flipFraction = 0.65; @@ -96,6 +96,11 @@ GitVisuals.prototype.resetAll = function() { GitVisuals.prototype.tearDown = function() { this.resetAll(); this.paper.remove(); + // Unregister the refresh tree listener so we dont accumulate + // these over time. However we aren't calling tearDown in + // some places... but this is an improvement + var Main = require('../app'); + Main.getEvents().removeListener('refreshTree', this.refreshTree); }; GitVisuals.prototype.assignGitEngine = function(gitEngine) { @@ -520,7 +525,7 @@ GitVisuals.prototype.calcTagStacks = function() { var map = {}; _.each(tags, function(tag) { var thisId = tag.target.get('id'); - + map[thisId] = map[thisId] || []; map[thisId].push(tag); map[thisId].sort(function(a, b) {