This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"root": true, | |
"parser": "@typescript-eslint/parser", | |
"plugins": [ | |
"@typescript-eslint" | |
], | |
"extends": [ | |
"eslint:recommended", | |
"plugin:@typescript-eslint/eslint-recommended", | |
"plugin:@typescript-eslint/recommended" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
{ | |
"compilerOptions": { | |
"lib": [ | |
"es5", | |
"es6" | |
], | |
"baseUrl": "./", | |
"emitDecoratorMetadata": true, | |
"esModuleInterop": true, | |
"experimentalDecorators": true, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function renderMicroFrontend(pathname) { | |
const microFrontend = routes[pathname || window.location.hash]; | |
const root = document.getElementById('microfrontend'); | |
root.innerHTML = microFrontend ? new microFrontend().render(): new Home().render(); | |
$(window).scrollTop(0); | |
} | |
$(window).bind( 'hashchange', function(e) { renderFrontend(window.location.hash); }); | |
renderFrontend(window.location.hash); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="zxx"> | |
<head> | |
<title>PetStore - because Pets love pampering</title> | |
<meta charset="UTF-8 | |
<link rel="stylesheet" href="css/style.css"/> | |
</head> | |
<body> | |
<!-- Header section --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Product extends MicroFrontend { | |
static get productDetails() { | |
return { | |
'1': { | |
name: 'Cat Table', | |
img: 'img/product/cat-table.jpg' | |
}, | |
'2': { | |
name: 'Dog House Sofa', | |
img: 'img/product/doghousesofa.jpg' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Cart extends MicroFrontend { | |
beforeMount() { | |
// get previously saved cart from backend | |
} | |
render() { | |
return `<!-- Page --> | |
<div class="page-area cart-page spad"> | |
<div class="container"> | |
<div class="cart-table"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// A virtual class from which all micro-frontends would extend | |
class MicroFrontend { | |
beforeMount() { | |
// do things before the micro front-end mounts | |
} | |
onChange() { | |
// do things when the attributes of a micro front-end changes | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
!DOCTYPE html> | |
<html lang="zxx"> | |
<head> | |
<title>The MicroFrontend - eCommerce Template</title> | |
</head> | |
<body> | |
<header class="header-section header-normal"> | |
<!-- Header is repeated in each frontend which is difficult to maintain --> | |
.... | |
.... |
NewerOlder