Comparing version 0.0.12 to 0.0.13
@@ -0,0 +0,0 @@ import { IRouteTransitionRedirectOptions } from "./types"; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ import { IHistory, IHistoryNavigateEvent } from "../types"; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ import { IHistory, IHistoryNavigateEvent } from "../types"; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ import { IHistory, IHistoryNavigateEvent } from "../types"; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ import { IRouteTemplate, IRouteMapper, IRouteParser, IRouteResolver, IRouteConstructable, MappingFunction } from "./types"; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ import { IRouteParser, IRouteParseResult } from "./types"; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ import { IRoute, IRouteParameters, IRouteInfo, IRouteTransitionPromiseResult, IRouteCancelableTransitionPromiseResult } from "./types"; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -12,2 +12,3 @@ import { IRouter, IRoute, IRouteTemplate, RouterContext, MappingFunction, IRouterOptions, IRouterNavigateOptions } from "./types"; | ||
private _context; | ||
private _onNavigate; | ||
readonly currentRoute: IRoute; | ||
@@ -17,2 +18,3 @@ readonly inTransition: boolean; | ||
readonly mapping: IRouteTemplate[]; | ||
onNavigate: (oldUrl: string, newUrl: string) => void; | ||
constructor(options?: IRouterOptions); | ||
@@ -19,0 +21,0 @@ map(mappingFn: MappingFunction): void; |
@@ -67,2 +67,12 @@ "use strict"; | ||
}); | ||
Object.defineProperty(Router.prototype, "onNavigate", { | ||
get: function () { | ||
return this._onNavigate; | ||
}, | ||
set: function (value) { | ||
this._onNavigate = value; | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
Router.prototype.map = function (mappingFn) { | ||
@@ -73,4 +83,6 @@ (_a = this.routes).push.apply(_a, this.mapper.mapping(mappingFn)); | ||
Router.prototype.navigate = function (path, options) { | ||
var _this = this; | ||
if (options === void 0) { options = {}; } | ||
path = utils.normalizePath(path); | ||
var oldPath = this.history.currentPath; | ||
this.history.setPath(path, options.replace); | ||
@@ -80,3 +92,7 @@ if (!options.silent) { | ||
} | ||
return Promise.resolve(); | ||
return Promise.resolve().then(function () { | ||
if (_this.onNavigate) { | ||
_this.onNavigate(oldPath, path); | ||
} | ||
}); | ||
}; | ||
@@ -83,0 +99,0 @@ Router.prototype.processPath = function (path) { |
@@ -0,0 +0,0 @@ import { IRoute, ITransitor, TransitionConflictStrategy, ITransition } from "./types"; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ /** |
@@ -0,0 +0,0 @@ /* Router */ |
export declare function normalizePath(path: string): string; |
@@ -0,0 +0,0 @@ "use strict"; |
{ | ||
"name": "steersman", | ||
"version": "0.0.12", | ||
"version": "0.0.13", | ||
"description": "Lightweight JS router for browsers & node", | ||
@@ -5,0 +5,0 @@ "main": "lib/Router.js", |
@@ -0,0 +0,0 @@ # Steersman |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
114696
980
33