Last active
December 10, 2017 16:41
-
-
Save deap82/fbc968a7f95906a7ff2487c34f60eeb3 to your computer and use it in GitHub Desktop.
Aurelia Gist - life cycle log
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
<template> | |
<ul id="menu"> | |
<li><a href="#/Welcome">Welcome</a></li> | |
<li><a href="#/Products">Products</a></li> | |
<li><a href="#/Contact">Contact</a></li> | |
</ul> | |
<div id="content"> | |
<router-view></router-view> | |
</div> | |
</template> |
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 App { | |
configureRouter(config, router) { | |
config.map([ | |
{ route: '', redirect: 'Welcome' }, | |
{ route: 'Welcome', name: 'Welcome', moduleId: 'page-welcome' }, | |
{ route: 'Products', name: 'Products', moduleId: 'page-products' }, | |
{ route: 'Contact', name: 'Contact', moduleId: 'page-contact' } | |
]); | |
} | |
} |
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 { inlineView, customElement } from 'aurelia-framework' | |
@inlineView('<template><div>Example Element</div></template>') | |
@customElement('example-element') | |
export class ExampleElement { | |
constructor() { | |
console.log('ExampleElement', 'constructor'); | |
} | |
created(owningView) { | |
console.log('ExampleElement', 'created'); | |
} | |
bind() { | |
console.log('ExampleElement', 'bind'); | |
} | |
attached() { | |
console.log('ExampleElement', 'attached'); | |
} | |
detached() { | |
console.log('ExampleElement', 'detached'); | |
} | |
unbind() { | |
console.log('ExampleElement', 'unbind'); | |
} | |
} |
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> | |
<title>Aurelia</title> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<link rel="stylesheet" href="styles.css" /> | |
</head> | |
<body aurelia-app> | |
<h1>Loading...</h1> | |
<script src="https://jdanyow.github.io/rjs-bundle/node_modules/requirejs/require.js"></script> | |
<script src="https://jdanyow.github.io/rjs-bundle/config.js"></script> | |
<script src="https://jdanyow.github.io/rjs-bundle/bundles/aurelia.js"></script> | |
<script src="https://jdanyow.github.io/rjs-bundle/bundles/babel.js"></script> | |
<script> | |
require(['aurelia-bootstrapper']); | |
</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
<template> | |
<h1>Contact</h1> | |
</template> |
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 Contact { | |
} |
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
<template> | |
<h1>Products</h1> | |
</template> |
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 Products { | |
} |
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
<template> | |
<require from="./example-element"></require> | |
<h1>Welcome</h1> | |
<example-element></example-element> | |
</template> |
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 Welcome { | |
activate() { | |
console.log('Welcome', 'activate'); | |
} | |
created() { | |
console.log('Welcome', 'created'); | |
} | |
bind() { | |
console.log('Welcome', 'bind'); | |
} | |
attached() { | |
console.log('Welcome', 'attached'); | |
} | |
detached() { | |
console.log('Welcome', 'detached'); | |
} | |
unbind() { | |
console.log('Welcome', 'unbind'); | |
} | |
} |
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
html, html *, html *:before, html *:after { | |
box-sizing: border-box; | |
} | |
body { | |
padding: 0; | |
margin: 0; | |
font-family: sans-serif; | |
} | |
#content { | |
padding: 10px; | |
} | |
#menu { | |
background: #26418f; | |
color: white !important; | |
padding: 10px; | |
margin: 0; | |
} | |
#menu li { | |
display: inline-block; | |
} | |
#menu li + li { | |
margin-left: 10px; | |
border-left: 1px solid white; | |
padding-left: 10px; | |
} | |
#menu li a { | |
color: white; | |
text-decoration: none; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment