-
-
Save blkbltjns/854f38ddfa0abac901ded323b2f3dae7 to your computer and use it in GitHub Desktop.
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> | |
<div id="container"> | |
<div repeat.for="item of items"> | |
<compose view-model="${item.viewModel}" model.bind="item.data"></compose> | |
</div> | |
</div> | |
<div style='margin-top: 20px'> | |
<div repeat.for="log of logs"> | |
${log} | |
</div> | |
</div> | |
<button click.delegate="click()">add</button> | |
</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
import {inject, TaskQueue} from 'aurelia-framework'; | |
@inject(TaskQueue) | |
export class App { | |
constructor(taskQueue) { | |
this.items = []; | |
this._taskQueue = taskQueue; | |
this.logs = []; | |
} | |
click() { | |
this.items.push({ | |
viewModel: 'child', | |
data: "C" | |
}); | |
this.logs.push('Height after click: ' + this._container.clientHeight); | |
} | |
bind() { | |
this.items.push({ | |
viewModel: 'child', | |
data: "A" | |
}); | |
this.items.push({ | |
viewModel: 'child', | |
data: "B" | |
}); | |
} | |
attached() { | |
this._container = document.getElementById('container'); | |
this.logs.push('Height after adding items: ' + this._container.clientHeight); | |
this._taskQueue.queueMicroTask(() => { | |
this.logs.push('Height after queued microtask: ' + this._container.clientHeight); | |
}); | |
setTimeout(() => { | |
this.logs.push('Height after waiting a second: ' + this._container.clientHeight); | |
}, 1000); | |
} | |
} |
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> | |
${data} | |
</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 Child { | |
activate(data) { | |
this.data = data; | |
} | |
} |
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"> | |
</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> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment