Update remaining templates to TypeScript 2 / @types / etc.

This commit is contained in:
Mark Pieszak
2016-10-17 09:59:13 +01:00
committed by SteveSandersonMS
parent a7ed0112db
commit f6d7321243
44 changed files with 105 additions and 12587 deletions

View File

@@ -1,8 +1,8 @@
import './css/site.css';
import * as ko from 'knockout';
import { createHistory } from 'history';
import './webpack-component-loader';
import AppRootComponent from './components/app-root/app-root';
const createHistory = require('history').createBrowserHistory;
// Load and register the <app-root> component
ko.components.register('app-root', AppRootComponent);

View File

@@ -13,7 +13,7 @@ class AppRootViewModel {
public route: KnockoutObservable<Route>;
private _router: Router;
constructor(params: { history: HistoryModule.History }) {
constructor(params: { history: History.History }) {
// Activate the client-side router
this._router = new Router(params.history, routes)
this.route = this._router.currentRoute;

View File

@@ -15,7 +15,7 @@ export class Router {
private disposeHistory: () => void;
private clickEventListener: EventListener;
constructor(history: HistoryModule.History, routes: Route[]) {
constructor(history: History.History, routes: Route[]) {
// Reset and configure Crossroads so it matches routes and updates this.currentRoute
crossroads.removeAllRoutes();
crossroads.resetState();
@@ -38,8 +38,11 @@ export class Router {
}
}
};
$(document).on('click', 'a', this.clickEventListener);
// Initialize Crossroads with starting location
// Need to cast history to 'any' because @types/history is out-of-date
crossroads.parse((history as any).location.pathname);
}
public dispose() {