Skip to content

v5.0.1 API changes to BeatEvents

Latest
Compare
Choose a tag to compare
@arjunmehta arjunmehta released this 19 Nov 02:43
· 9 commits to master since this release

Breaking change

Some slight but more useful and clear changes to BeatEvent creation and callbacks.

heart.createEvent now accepts countTo as an option in place of of repeat, and the callbacks are now called with the number of times that event has happened instead of the heart's age.

This makes more sense than before, where the keyword repeat was a bit confusing, and the heartAge as the callback argument was less useful.

Before

heart.createEvent(5, {repeat: 2}, function(heartAge, last){
  console.log('...heart age is', heartAge);
});

Now

heart.createEvent(5, {countTo: 2}, function(count, last){
  console.log('...Has happened', count, 'times');
});