-
-
Save jdanyow/39076c2f729b4756327238749f4ce6c5 to your computer and use it in GitHub Desktop.
Aurelia: Suboptimal repeat element lifecycle [alternative without compose]
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="./component"></require> | |
<input type="checkbox" ref="isFiltering"> | |
<br> | |
<component | |
repeat.for="id of components | without8: isFiltering.checked" | |
id.bind="id" | |
></component> | |
</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 {Component} from './component' | |
export class App { | |
constructor() { | |
this.components = [] | |
for (let i = 1; i <= 10000; i++) { | |
this.components.push(i) | |
} | |
} | |
} | |
export class Without8ValueConverter { | |
toView(array, isEnabled) { | |
return isEnabled ? array.filter(element => element !== 8) : array | |
} | |
} |
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, bindable} from 'aurelia-framework' | |
@inlineView('<template>${id}<br></template>') | |
export class Component { | |
@bindable id | |
// bind() { | |
// console.log('bind', this.id) | |
// } | |
// unbind() { | |
// console.log('unbind', this.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
<!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