I have a variable as such:
randomVariable= 0;
var randomVariableDep= new Tracker.Dependency;
and it’s set and get functions are the following:
setRandomVariable= function (newValue) { randomVariable= newValue; randomVariableDep.changed(); };
getRandomVariable= function(){
randomVariableDep.depend();
return randomVariable;
}
I have a template, as such:
Template.random.helpers({ someFunctioin: function() { return getRandomVariable(); } });
and in my HTML file, I have:
<template name="random"> {{someFunction}} </template>
and I use it within the HTML file as such: {{> random}}
The template helper keeps on repeating over and over again and makes the application lag and makes it unusable. How can I fix this?