Flow-router + Blaze + DOM ready onRendered

Hi there,

I am running in circle and I think it’s time to break it !!

Template.myTpl.onCreated(function () {
var self = this;
self.autorun(function() {
getMyColl: function() {
return Coll.findOne({_id: xxx});
Template.myTpl.onRendered(function () {
var myVar = this.data.chrono // I expect to get the collection var once it is ready from tpl
function chronometer() {
$(’.chronodiv’).html(myVar ++);
setInterval(chronometer, 1000); // Increment the var every sec


{{#if Template.subscriptionsReady}}



Basically I would like to achieve:

  1. Subscribe and retrieve data from subscription
  2. Once data ready execute onRendered with data from current subscription
  3. Use jQuery after DOM ready

In the end it’s about adding jquery’s functions or plugins after the page is ready, there are some exemple online but nothing clear (to me ;)).

How would implement a simple chronometer based on collection data with flow-router, blaze and template level subscriptions ?

Thank you in advance :wink: