Skip to content

Commit

Permalink
Merge pull request #520 from andyburke/fix_dispatching
Browse files Browse the repository at this point in the history
fix dispatching bug introducted in page.create refactor
  • Loading branch information
matthewp authored Nov 1, 2018
2 parents dabcde7 + 6ad51c8 commit 08af410
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 823 deletions.
8 changes: 3 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
this.len = 0;

// private things
this._dispatch = true;
this._decodeURLComponents = true;
this._base = '';
this._strict = false;
Expand All @@ -64,7 +63,6 @@
var opts = options || {};

this._window = opts.window || (hasWindow && window);
this._dispatch = opts.dispatch !== false;
this._decodeURLComponents = opts.decodeURLComponents !== false;
this._popstate = opts.popstate !== false && hasWindow;
this._click = opts.click !== false && hasDocument;
Expand Down Expand Up @@ -149,7 +147,7 @@
Page.prototype.start = function(options) {
this.configure(options);

if (!this._dispatch) return;
if (false === options.dispatch) return;
this._running = true;

var url;
Expand All @@ -166,7 +164,7 @@
}
}

this.replace(url, null, true, this._dispatch);
this.replace(url, null, true, options.dispatch);
};

/**
Expand Down Expand Up @@ -203,7 +201,7 @@
prev = this.prevContext;
this.prevContext = ctx;
this.current = ctx.path;
if (this._dispatch) this.dispatch(ctx, prev);
if (false !== dispatch) this.dispatch(ctx, prev);
if (false !== ctx.handled && false !== push) ctx.pushState();
return ctx;
};
Expand Down
Loading

0 comments on commit 08af410

Please sign in to comment.