Skip to content

Instantly share code, notes, and snippets.

@jdanyow
Forked from niieani/app.html
Created April 18, 2016 20:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jdanyow/39076c2f729b4756327238749f4ce6c5 to your computer and use it in GitHub Desktop.
Save jdanyow/39076c2f729b4756327238749f4ce6c5 to your computer and use it in GitHub Desktop.
Aurelia: Suboptimal repeat element lifecycle [alternative without compose]
<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>
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
}
}
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)
// }
}
<!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