81
rated 0 times
[
88]
[
7]
/ answers: 1 / hits: 87508
/ 12 Years ago, fri, january 25, 2013, 12:00:00
I am trying to save a data object in chrome sync storage and then retrieve it, however the get() function always returns an empty object. The code I am using is,
function storeUserPrefs() {
var key='myKey', testPrefs = {'val': 10};
chrome.storage.sync.set({key: testPrefs}, function() {console.log('Saved', key, testPrefs);});
}
function getUserPrefs() {
chrome.storage.sync.get('myKey', function (obj) {
console.log('myKey', obj);
});
}
Could someone please tell me what I am doing wrong here?
More From » google-chrome