> var index=0;
enyo.kind({
name:"Kapping",
events: {
onBeat: ""
},
create : function(){
this.inherited(arguments);
this.timer = window.setInterval(enyo.bind(this,"beat"),1000);
},
destroy : function(){
if(this.timer != undefined){
window.clearInterval(this.timer);
}
this.inherited(arguments);
},
beat: function(){
this.doBeat({
//this.fetch();
});
index = index+1;
console.log('Doing beat ' + index);
}
}); /*
new Kapping().renderInto(document.body);
In which beat
function is getting called 2 times.
and another one is
> var i =0;
enyo.kind({
name:"Heartbeat",
events: {
onBeat: ""
},
create : function(){
this.inherited(arguments);
this.timer = window.setInterval(enyo.bind(this,"beat"),1000);
},
destroy : function(){
if(this.timer != undefined){
window.clearInterval(this.timer);
}
this.inherited(arguments);
},
beat: function(){
this.doBeat({
});
i=i+1;
console.log("In timer callback " + i);
}
});
new Heartbeat().renderInto(document.body);
In this beat
function is getting called only once.
What am I missing?