I'm confused about how _uihooks
works. Check out the below code:
home.html
<template name="homePage">
<section id="home-page">
<div class="container">
<h1>Thought of the day:</h1>
<div id="totd">
<span>{{thought}}</span>
</div>
</div>
</section>
</template>
home.coffee
timer = 0
Template.homePage.rendered = ->
this.find('#totd')._uihooks =
insertElement: (node, next) ->
console.log 'Inserted'
removeElement: (node) ->
console.log 'Removed'
Session.set 'randThought', Random.choice thoughts
timer = Meteor.setInterval shuffleThoughts, 5000
Template.homePage.destroyed = ->
Meteor.clearInterval timer
thoughts = [
"My socks smell like sausages."
"I sure wish I had a bag of crisps right about now."
"I need more thoughts."
]
Template.homePage.helpers
thought: -> Session.get 'randThought'
shuffleThoughts = ->
Session.set 'randThought', Random.choice thoughts
I'd like the random thoughts to fade out/in nicely. But I never see anything show up in the console, so apparently it's not working. What exactly triggers _uihooks
? What am I doing wrong?