如何正确使用 Spotify Views API?
https://developer.spotify.com/technologies/apps/docs/preview/views/index.html
我正在尝试在 div 中实现一个 throbber,所以我使用以下代码:
require(['$views/throbber#Throbber'], function(Throbber) {
var favs = document.getElementById('favs');
var throbber = Throbber.forElement(favs);
});
但这会引发“ReferenceError:require is not defined”。当我这样使用它时:
var sp = getSpotifyApi();
sp.require(['$views/throbber#Throbber'], function(Throbber) {
var favs = document.getElementById('favs');
var throbber = Throbber.forElement(favs);
});
它抛出了这个错误。“TypeError: Object $views/throbber#Throbber has no method 'match'”。