Permalink
Browse files

removed global leaks

  • Loading branch information...
1 parent 4e3c7fd commit 4db6ac070f6de16f145ed5625978729b526e9dfb @jamuhl jamuhl committed Feb 24, 2012
Showing with 8 additions and 6 deletions.
  1. +2 −2 Jakefile.js
  2. +1 −1 lib/eventDispatcher.js
  3. +5 −3 lib/eventStore.js
View
@@ -58,7 +58,7 @@ task('doc', [], function() {
var pathDepth = function(str) {
var deep = (str.split("/").length - 1) * 2;
var sep = '';
- for (i = 0; i < deep; i++) {
+ for (var i = 0; i < deep; i++) {
sep += ' ';
}
return sep;
@@ -72,7 +72,7 @@ var pathDepth = function(str) {
var dirs = function(path) {
var parts = path.split('/')
, arr = [];
- for (i = 0, y = 0, len = parts.length; i < len; i++) {
+ for (var i = 0, y = 0, len = parts.length; i < len; i++) {
var dir = parts[0];
for (z = 1; z <= y; z++) {
dir += '/' + parts[z];
@@ -97,7 +97,7 @@ EventDispatcher.prototype = {
this.storage.getUndispatchedEvents(function(err, events) {
if (events) {
- for (i = 0, len = events.length; i < len; i++) {
+ for (var i = 0, len = events.length; i < len; i++) {
self.undispatchedEventsQueue.push(events[i]);
}
}
View
@@ -93,6 +93,8 @@ Store.prototype = {
this.dispatcher.send({ action: 'use', payload: { options: this.options, storageModulePath: this.storage.filename } });
this.dispatcher.on('message', function(m) {
if (m.action === 'publish') {
+ console.log('hurray');
+ console.log(self.publisher);
self.publisher.publish(JSON.deserialize(m.payload));
}
});
@@ -323,7 +325,7 @@ Store.prototype = {
if (this.hasConfigurationErrors(callback)) return;
- self = this;
+ var self = this;
async.waterfall([
@@ -336,7 +338,7 @@ Store.prototype = {
var event
, currentRevision = eventstream.currentRevision();
- for (i = 0, len = eventstream.uncommittedEvents.length; i < len; i++) {
+ for (var i = 0, len = eventstream.uncommittedEvents.length; i < len; i++) {
event = eventstream.uncommittedEvents[i];
event.commitId = id;
event.commitSequence = i;
@@ -462,7 +464,7 @@ EventStream.prototype = {
currentRevision: function() {
var rev = this.lastRevision;
- for (i = 0, len = this.events.length; i < len; i++) {
+ for (var i = 0, len = this.events.length; i < len; i++) {
if (this.events[i].streamRevision > rev) {
rev = this.events[i].streamRevision;
}

0 comments on commit 4db6ac0

Please sign in to comment.