Why Template.myTemplate.rendered created destroyed fire multiple times ? #435

Closed
crapthings opened this Issue Oct 29, 2012 · 2 comments

Comments

Projects
None yet
2 participants
@crapthings
Template['module-following-item'].destroyed = ->
    console.log 'this will fire multiple times'

maybe the events bind multiple times too ? is this normal ?

if i have 20 Template['module-following-item'], when every single template destroyed, it will execute function 20 times.

@crapthings

This comment has been minimized.

Show comment Hide comment
@crapthings

crapthings Oct 29, 2012

Say if i have 400 docs publish to client, and every template's function and binding event fire two times, they cause 800 executes.

Say if i have 400 docs publish to client, and every template's function and binding event fire two times, they cause 800 executes.

@glasser

This comment has been minimized.

Show comment Hide comment
@glasser

glasser Nov 1, 2012

Member

That's what they're supposed to do. These callbacks are associated with a particular instance of a template on the screen, so if you display a template 400 times they each get called 400 times.

What are you trying to accomplish with these callbacks that would work better if only called once?

Member

glasser commented Nov 1, 2012

That's what they're supposed to do. These callbacks are associated with a particular instance of a template on the screen, so if you display a template 400 times they each get called 400 times.

What are you trying to accomplish with these callbacks that would work better if only called once?

@glasser glasser closed this Nov 1, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment