ts migration package.json
This commit is contained in:
49
webseite-ts/frontend/dev/scripts/main.ts
Normal file
49
webseite-ts/frontend/dev/scripts/main.ts
Normal file
@@ -0,0 +1,49 @@
|
||||
// import 'bootstrap'; // ohne Pfadangabe (Modul auslesen aus node_modules) funktioniert nur mit JS-Bundler (esbuild, rollup & co.)
|
||||
|
||||
import ProductManager from './modules/ProductManager'; // Dateiendung kann weggelassen werden, wenn ein Bundler eingesetzt wird (esbuild, webpack, rollup, etc.)
|
||||
import Splide from '@splidejs/splide';
|
||||
|
||||
(() => {
|
||||
// === DOM & VARS =======
|
||||
const DOM = {};
|
||||
|
||||
// === INIT =============
|
||||
const init = () => {
|
||||
console.log('init');
|
||||
router();
|
||||
};
|
||||
|
||||
// === EVENTHANDLER =====
|
||||
|
||||
// === XHR/FETCH ========
|
||||
|
||||
// === FUNCTIONS ========
|
||||
const router = () => {
|
||||
const path = window.location.pathname;
|
||||
|
||||
console.log(path);
|
||||
|
||||
switch (path) {
|
||||
case '/':
|
||||
case '/index.html':
|
||||
console.log('HOME');
|
||||
const splider = new Splide('.splide', {
|
||||
type: 'loop',
|
||||
fixedHeight: '100%',
|
||||
height: '100%',
|
||||
autoHeight: true,
|
||||
}).mount();
|
||||
|
||||
// nur Skripte, die für Home relevant ausführen
|
||||
break;
|
||||
case '/projects/product-manager.html':
|
||||
console.log('PRODUCT_MANAGER');
|
||||
const pm = ProductManager();
|
||||
break;
|
||||
default:
|
||||
console.warn('Page not found');
|
||||
}
|
||||
};
|
||||
|
||||
init();
|
||||
})();
|
||||
Reference in New Issue
Block a user