Comparing version 0.0.20 to 0.0.21
@@ -14,2 +14,3 @@ "use strict"; | ||
function Router(options) { | ||
var _this = this; | ||
if (options === void 0) { options = {}; } | ||
@@ -25,11 +26,19 @@ this.options = { | ||
this.transitor = new Transitor_1.Transitor(this.options.transitionStrategy); | ||
var historyNavigateHandler = function (newPath) { | ||
var oldPath = _this.history.currentPath; | ||
_this.processPath(newPath).then(function () { | ||
if (_this.onNavigate) { | ||
_this.onNavigate(oldPath, newPath); | ||
} | ||
}); | ||
}; | ||
switch (this.options.historyProvider) { | ||
case "virtual": | ||
this.history = new VirtualHistory_1.VirtualHistory(this.processPath.bind(this)); | ||
this.history = new VirtualHistory_1.VirtualHistory(historyNavigateHandler); | ||
break; | ||
case "hash": | ||
this.history = new HashHistory_1.HashHistory(this.processPath.bind(this)); | ||
this.history = new HashHistory_1.HashHistory(historyNavigateHandler); | ||
break; | ||
case "history": | ||
this.history = new BrowserHistory_1.BrowserHistory(this.processPath.bind(this)); | ||
this.history = new BrowserHistory_1.BrowserHistory(historyNavigateHandler); | ||
break; | ||
@@ -36,0 +45,0 @@ } |
{ | ||
"name": "steersman", | ||
"version": "0.0.20", | ||
"version": "0.0.21", | ||
"description": "Lightweight JS router for browsers & node", | ||
@@ -5,0 +5,0 @@ "main": "lib/Router.js", |
Sorry, the diff of this file is not supported yet
1017
69208