mirror of
https://github.com/aspnet/JavaScriptServices.git
synced 2025-12-24 18:47:30 +00:00
Initial KnockoutSpa template
This commit is contained in:
23
templates/KnockoutSpa/ClientApp/boot.ts
Normal file
23
templates/KnockoutSpa/ClientApp/boot.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import 'bootstrap';
|
||||
import 'bootstrap/dist/css/bootstrap.css';
|
||||
import './css/site.css';
|
||||
import * as ko from 'knockout';
|
||||
import appLayout from './components/app-layout/app-layout';
|
||||
|
||||
ko.components.register('app-layout', appLayout);
|
||||
ko.applyBindings();
|
||||
|
||||
// Basic hot reloading support. Automatically reloads and restarts the Knockout app each time
|
||||
// you modify source files. This will not preserve any application state other than the URL.
|
||||
declare var module: any;
|
||||
if (module.hot) {
|
||||
module.hot.dispose(() => {
|
||||
ko.cleanNode(document.body);
|
||||
|
||||
// TODO: Need a better API for this
|
||||
Object.getOwnPropertyNames((<any>ko).components._allRegisteredComponents).forEach(componentName => {
|
||||
ko.components.unregister(componentName);
|
||||
});
|
||||
});
|
||||
module.hot.accept();
|
||||
}
|
||||
Reference in New Issue
Block a user