Last active
September 8, 2022 14:15
-
-
Save miniben-90/5dc43ea77422d5fd1d0f2cd03b529d34 to your computer and use it in GitHub Desktop.
test load lifehooks
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> | |
<head> | |
<meta charset="utf-8"> | |
<title>Dumber Gist</title> | |
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0, user-scalable=no"> | |
<base href="/"> | |
</head> | |
<!-- | |
Dumber Gist uses dumber bundler, the default bundle file | |
is /dist/entry-bundle.js. | |
The starting module is pointed to "main" (data-main attribute on script) | |
which is your src/main.ts. | |
--> | |
<body> | |
<my-app></my-app> | |
<script src="/dist/entry-bundle.js" data-main="main"></script> | |
</body> | |
</html> |
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
{ | |
"dependencies": { | |
"aurelia": "latest" | |
} | |
} |
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
import Aurelia from "aurelia"; | |
import { RouterConfiguration } from '@aurelia/router'; | |
import { MyApp } from "./my-app"; | |
Aurelia.register(RouterConfiguration.customize({ resolutionMode: 'static' })).app(MyApp).start(); |
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
Missing page :( |
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
export class MissingPage { | |
public static parameters = ["id"]; | |
public missingComponent: string; | |
public load(parameters: { id: string }): void { | |
this.missingComponent = parameters.id; | |
} | |
} |
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
.message { | |
background-color: lightblue; | |
} |
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
<div> | |
<ul> | |
<li> | |
<a load="/">Page 1</a> | |
</li> | |
<li> | |
<a load="/page-2">Page 2</a> | |
</li> | |
<li> | |
<a load="/page-3">Page 3</a> | |
</li> | |
</ul> | |
</div> | |
<import from="./missing-page"></import> | |
<au-viewport name="main" fallback="missing-page"></au-viewport> |
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
import { lifecycleHooks } from 'aurelia'; | |
import { type IRoutableComponent, type IRoute } from "@aurelia/router"; | |
@lifecycleHooks() | |
export class MyApp implements IRoutableComponent { | |
static routes: IRoute[] = [ | |
{ | |
id: "page-1", | |
path: ["", "page-1"], | |
component: () => import("./pages/page-1"), | |
viewport: 'main' | |
}, | |
{ | |
id: "page-2", | |
path: ["page-2"], | |
component: () => import("./pages/page-2"), | |
viewport: 'main' | |
}, | |
{ | |
id: "page-3", | |
path: ["page-3"], | |
component: () => import("./pages/page-3"), | |
viewport: 'main' | |
}, | |
]; | |
load() { | |
console.log('test', arguments); | |
} | |
} |
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
I'm a page. I'm the first one <a load="route:page-2">click to go 2</a> |
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
export class Page1 { | |
/** */ | |
} |
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
I'm a page. I'm the second one <a load="/page-3">click to go 3</a> |
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
export class Page2 { | |
/** */ | |
} |
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
I'm 3 |
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
export class Page3 { | |
/** */ | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment