I'm trying to make a Chrome extension using chrome.storage.sync, using the following object:
var storage = {
  "area":chrome.storage.sync,
  "get":function(key){
    var result = true,
      callback = function(items){
        result = items[key];
      };
    this.area.get(key,callback);
    return result;
  },
  "set":function(key,value){
    //create an empty object for a key:value pair
    var object = {};
    object[key] = value;
    console.log(object);
    this.area.set(object,function(){
     console.log(object);
    });
  }
};
But the "get" method never returns the result. It only returns "true" in this example. Why can't I get the actual value of the item, store it in result, and return it? Does it take time for Chrome to fetch the key:value pairs? If so, how do I work around this?
 
    