0
我有一個函數:如何通過參數獲取Chrome本地存儲結果的值映射?
// Get the value out of Chrome local storage
chrome.storage.local.get(sourcePath, function(result) {
// Test the result
alert(JSON.stringify(result.sourcePath));
});
和呼叫檢查一下:
chrome.storage.local.set({'userAcceptanceAgreement': true});
現在,我想知道如何讓我的功能,當上述參數調用,以將該值傳遞給警報。因爲它顯示的result
正確的存儲值爲{'userAcceptanceAgreement': true}
,但出現未定義,因爲它沒有試圖找到參數的key:值對,而是爲文字sourcePath
。