Skip to content

Commit

Permalink
Trying to fake keyed updates into working
Browse files Browse the repository at this point in the history
  • Loading branch information
TehShrike committed Jul 24, 2017
1 parent 17e64d2 commit 3f3928f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
public/bundle*
node_modules
6 changes: 3 additions & 3 deletions src/App.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

<ol>
{{#each arrayToDisplay as id}}
<Top bind:top="idToTop[id]">
<Top bind:top="idToTop[id]" key="{{id}}">
<li>{{id}}: top is {{idToTop[id]}}</li>
</Top>
{{/each}}
</ol>

<script>
import Top from './Top.html'

export default {
data() {
return {
Expand All @@ -31,4 +31,4 @@
this.observe('idToTop', map => console.log(map))
}
}
</script>
</script>
5 changes: 5 additions & 0 deletions src/Top.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@
window.addEventListener('scroll', listener)
this.set({ listener })
this.updateTop()

this.observe('key', id => {
console.log('detected id change to', id)
this.updateTop()
})
},
ondestroy() {
const listener = this.get('listener')
Expand Down

0 comments on commit 3f3928f

Please sign in to comment.