last.fm & plug.dj API를 사용하여 크롬 확장 프로그램을 만들려고합니다. 확장 프로그램에 스크립트를 포함시키기 전까지는 작동하지 않았기 때문에 연결할 수 없습니다. 그들 모두에게. 는 I 다른 API에 액세스 스크립트에서 다른 곳에서 새로운 LastFMCache에확장 프로그램이 클래스를 찾을 수 없습니다.
{
"content_scripts": [ {
"js": [ "jquery.js","lastfm.api.md5.js", "lastfm.api.cache.js", "lastfm.api.js","lastFMLink.js", "script.js"],
"css": [ "LastFMLink.css" ],
"matches": [ "http://plug.dj/*", "http://plug.dj/*/*" ],
"run_at": "document_end"
} ],
"name": "Plug.Dj VS last.Fm",
"description": "Implement information about the artist",
"icons": { "16": "cookie.png", "48": "cookie.png", "128": "cookie.png" },
"permissions": [ "http://plug.dj/*", "http://plug.dj/*/*" ],
"version": "0.0.1",
"web_accessible_resources": [ "lastFMLink.js"],
"manifest_version": 2
}
그 오류를 내의 manifest.json에 다음()과와
function Setup(){
console.log('Setup');
API.addEventListener(API.DJ_ADVANCE, callback);
cache = new LastFMCache();
lastfm = new LastFM({
apiKey: '<key>',
apiSecret: '<secret>',
cache: cache
});
}
:이 설정 스크립트입니다. 다른 스크립트 (lastFMLink.js 및 lastFMLink.css와 같은)가로드되고 weir 것은 이벤트 리스너입니다.
버튼을 누르면 설치 스크립트 get이로드되고 아직 초기화되지 않았으므로 일반적으로 스크립트 순서 때문에 오류가 발생하지 않습니다.
누군가가 잘못 될 수있는 단서가 있습니까?