Reputation: 325
Is there any event fired when track gets starred or unstarred in the Spotify JavaScript API? If yes, how can I define a callback for this?
Upvotes: 0
Views: 138
Reputation: 18776
You need to watch the starred playlist for item changes:
var sp = getSpotifyApi();
var models = sp.require('$api/models');
var playlist = models.library.starredPlaylist;
playlist.observe(models.EVENT.ITEMS_ADDED, function() {
console.log('New starred tracks!');
console.log(playlist.tracks);
});
Upvotes: 2