我在使用SoundCloud getter getCurrentSound(回调)时遇到问题。我正在尝试将当前小部件中的歌曲存储为var,这样我就可以将它作为param传递给我的一个ruby方法。
我尝试过以下几种方法,但都不起作用:
var current song = SC.Widget("sc-widget").getCurrentSound() 下面是关于SoundCloud使用的getter的信息:http://developers.soundcloud.com/docs/api/html5-widget
发布于 2013-02-14 06:49:56
如果文档没有清楚地说明这一点,很抱歉。getCurrentSound()方法是异步的,因此它不返回值,而是接受回调。试着这样做:
var widget = SC.Widget(...);
widget.getCurrentSound(function(sound) {
console.log(sound.title);
});希望这能有所帮助。如果还不清楚,请告诉我。
https://stackoverflow.com/questions/14862440
复制相似问题