如果用户订阅/取消订阅播放列表,有什么方法可以通知?
理想情况下,我希望能够做这样的事情:
var sp = getSpotifyApi(1);
var models = sp.require('sp://import/scripts/api/models');
var playlist = models.Playlist.fromURI("spotify:user:spotify:playlist:3Yrvm5lBgnhzTYTXx2l55x");
playlist.observe(models.EVENT.SUBSCRIBE, function() { // <-- This "SUBSCRIBE" event don't exist...
console.log("Playlist was subscribed/unsubscribed!");
});
/* later in code */
playlist.subscribed = true; // Outputs: Playlist was subscribed/unsubscribed!
有没有什么模式可以完成这样的事情?
最终,我想根据运行时是否订阅播放列表来更改几个不同对象的 gui 状态。但是这些对象彼此并不了解,它们是从同一 URI 创建的 Spotify 播放列表对象的唯一共同点。