Last active
June 23, 2017 11:27
-
-
Save ZoolWay/6704584ca04199a143e349a6e91a5e5c to your computer and use it in GitHub Desktop.
Aurelia Binding ES6 Map
This file contains hidden or 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>Aurelia Debounce</h1> | |
<div ref="areaContainer"> | |
<h2>Textbox:</h2> | |
<div style="border:1px solid blue; padding: 1em; margin: 1em;"> | |
<input value.bind="myMap['masterkey']" placeholder="type here" /> | |
</div> | |
<div style="border:1px solid black; padding: 1em; margin: 1em;"> | |
output: ${myMap['masterkey']} | |
</div> | |
<div style="border:1px solid black; padding: 1em; margin: 1em;"> | |
output: ${myMap.get('masterkey')} | |
</div> | |
<button click.delegate="changeMaster()">Change Master Key</button> | |
</div> | |
</template> |
This file contains hidden or 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 { observable } from 'aurelia-framework' | |
export class App { | |
myText = ''; | |
myMap = new Map(); | |
constructor() { | |
this.myMap.set('masterkey', '-42-'); | |
this.myMap.set('housekey', 'peach'); | |
} | |
changeMaster() { | |
let current = this.myMap.get('masterkey'); | |
if (current === '-42-') { | |
this.myMap.set('masterkey', '+84+'); | |
} else { | |
this.myMap.set('masterkey', '-42-'); | |
} | |
} | |
} |
This file contains hidden or 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"> | |
</head> | |
<body aurelia-app="main"> | |
<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 hidden or 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 function configure(aurelia) { | |
aurelia.use.standardConfiguration(); | |
aurelia.start().then(() => aurelia.setRoot()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment