Chrome扩展程序:storage.set()不接受变量作为关键字

时间:2016-04-10 15:45:21

标签: javascript google-chrome google-chrome-extension

我正在尝试在我的扩展程序中使用chrome.storage.local.set({'test': 'foo'}, function() { chrome.storage.local.get('test', function(data) { console.log("Test Result: ") console.log(data); }) }); var keyword = 'test2'; chrome.storage.local.set({keyword: 'foo'}, function() { chrome.storage.local.get(keyword, function(data) { console.log("Test 2 Result: ") console.log(data); }) }); 。这是我编写的测试:

test

第一个和第二个测试之间的唯一区别是我用字符串test2替换了字符串Test Result: Object {test: "foo"} Test 2 Result: Object {} 。现在,你希望这两者都有效,对吗?输出是:

PS C:\Development\symstore add /f @C:\temp\dllsAndPdbsToAdd.txt /s C:\temp\symstore\ /t AwesomeProject 
SYMSTORE MESSAGE: 0 alternate indexers registered
SYMSTORE MESSAGE: LastId.txt reported id 8
SYMSTORE MESSAGE: Final id is 0000000008
SYMSTORE ERROR: Class: Internal. Desc: Failed to index C:\Development\AwesomeProject\ÿþC. Line: 169. Error 32

我做错了什么?

0 个答案:

没有答案