事件页面中的奇怪行为:TypeError

时间:2014-08-16 06:42:00

标签: javascript google-chrome-extension bookmarks

我尝试在活动页面中执行此操作。

// When the browser action is clicked, call the
// getBm function.
chrome.browserAction.onClicked.addListener(getBm);


function getBm () {
    var url = 'test.html';
    dumpBookmarks();
    chrome.tabs.create({ url: url });  
}


function dumpBookmarks() {
    var b = chrome.bookmarks.getTree(
        function(bookmarkTreeNodes) {
            console.log(bookmarkTreeNodes); --------(1)
        });
}

function dumpTreeNodes(bookmarkNodes) {
   //do something here    
}

这很好但是如果我尝试

console.log(dumpTreeNodes(bookmarkTreeNodes));

在(1)它抛出错误,

Error in response to bookmarks.getTree: TypeError: undefined is not a function

0 个答案:

没有答案
相关问题