lundi 29 juin 2015

Making an Array in chrome.storage and retrieving data


So I'm in a bit of a dillema right now. I can't seem to be able to add an Array in chrome.storage and later retrieving it. Here's the code I have right now:

function() {
    chrome.storage.sync.get({ObjectName: []}, function (result) {
    var ObjectName = result.ObjectName;
    ObjectName.push({ArrayName: document.getElementById("field")});
    });

Now to retrieve it and display it:

chrome.storage.sync.get({ArrayName: function(value) {
            for(i=0; i<value.length; i++) { 
                document.write(value)
            };

The error I am getting, which might be as simple as a syntax issue, amounts to:

Error: Invocation of form get(object) doesn't match definition get(optional string or array or object keys, function callback)


Aucun commentaire:

Enregistrer un commentaire