Advertisement
Guest User

Untitled

a guest
Nov 18th, 2013
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. chrome.storage.sync.get($div.attr('id'),function(items){
  2. var lastError = chrome.runtime.lastError;
  3. if (lastError) console.log($div.attr('id')+" does not exist.n", lastError);
  4. else chrome.storage.sync.set({$div.attr('id'):$div.html()}, function(){}); //I'm having the error from this line
  5. });
  6.  
  7. var myobj = {}, key = $div.attr('id');
  8. myobj[key] = $div.html();
  9. chrome.storage.sync.get(key,function(items){
  10. var lastError = chrome.runtime.lastError;
  11. if (lastError) console.log(key+" does not exist.n", lastError);
  12. else chrome.storage.sync.set(myobj, function(){}); //The error is gone
  13. });
  14.  
  15. {$div.attr('id'):$div.html()}
  16.  
  17. else {
  18. var obj = {}, key = $div.attr('id');
  19. obj[key] = $div.html();
  20. chrome.storage.sync.set(obj, function(){});
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement