google-chrome-storage

Override Chrome Storage API

风流意气都作罢 提交于 2021-02-17 05:44:07
问题 I would like to override chrome.storage.local.set in order to log the value of a storage key when the Chrome Storage API is called: var storage_local_set = chrome.storage.local.set; chrome.storage.local.set = function(key, value) { console.log(key); storage_local_set(key); } But I get Illegal invocation: Function must be called on an object of type StorageArea when storage_local_set(key) gets called. How can I store the data after logging the key? For chrome.storage.sync.set this is what I

chrome sync storage to store and update array

不羁岁月 提交于 2020-06-22 11:42:07
问题 is it possible to store array in chrome storage sync and retrieve them ? var uarray = [abc,def,ghi]; Is it possible to update the stored array in the storage ? var tobeadded = jkl; uarray.push(tobeadded); this was the syntax in documentation chrome.storage.sync.set({'value': theValue}, function() { // Notify that we saved. message('Settings saved'); }); My bookmark extension, need to store the id of bookmark and retrieve them for internal search and stuffs based on it. bookmarking needs

Using a variable key in chrome.storage.local.set [duplicate]

梦想与她 提交于 2020-01-10 03:05:14
问题 This question already has answers here : chrome.storage.local.set using a variable key name (2 answers) Closed 3 years ago . I am creating a chrome-extension. I don't know how to use a variable as the key to chrome.storage.local.set() function. I have tried var key = 'myKey'; chrome.storage.local.get(key, function(val) { chrome.storage.local.set({key:val[key]+param1}); //appending param1 alert(val[key]); } Here i am trying to get the value of val[key] and append a string param1 and place it

Chrome extensions: chrome.storage.local.get headache

有些话、适合烂在心里 提交于 2020-01-06 06:48:10
问题 Trying to build a simple Chrome extension to output the whole contents of localStorage. How difficult should it be? Spent a few hours researching and trying, still doesn't work :( Appreciate assistance! For example: function load() { chrome.storage.local.get(null, function(items) { var allKeys = Object.keys(items); alert(allKeys.count); }); } document.addEventListener('DOMContentLoaded', () => { load(); }); outputs 'undefined' Some other ways I tried actually contained an object, but I couldn

How to call chrome extension content script once upon entering domain

回眸只為那壹抹淺笑 提交于 2019-12-25 07:24:59
问题 I have a chrome extension that operates on multiple paths of a domain. The functionality I am trying to achieve is upon entering the domain (any of the paths) I call a content script (content_script_getdata.js) that parses the data and stores it in chrome.storage.local. After entering, navigation between the paths doesn't need to call content_script_getdata.js. Each path has it's own content script that gets from chrome.storage.local and updates the UI of that path based on the data. How can

How do I use Promise.all() with chrome.storage()?

走远了吗. 提交于 2019-12-23 02:38:37
问题 I have several async functions running. I want to wait for them all to finish before taking the next steps. Here's my code that I'm using to get all of the key/values from chrome.storage and the Promise.all() implementation. var promise1 = Promise.resolve(3); var promise2 = 42; var promise3 = new Promise(function(resolve, reject) { setTimeout(resolve, 100, 'foo'); }); var getAll = chrome.storage.sync.get(function(result) { console.log(result) }); Promise.all([promise1, promise2, promise3,

chrome.storage.sync.remove array doesn't work

梦想的初衷 提交于 2019-12-21 05:24:05
问题 I am making a small Chrome extension. I would like to use chrome.storage but I can't get it to delete multiple items (array) from storage. Single item removal works. function clearNotes(symbol) { var toRemove = "{"; chrome.storage.sync.get(function(Items) { $.each(Items, function(index, value) { toRemove += "'" + index + "',"; }); if (toRemove.charAt(toRemove.length - 1) == ",") { toRemove = toRemove.slice(0,- 1); } toRemove = "}"; alert(toRemove); }); chrome.storage.sync.remove(toRemove,

Chrome.Storage.Local Persistence

空扰寡人 提交于 2019-12-18 11:35:18
问题 all. I've started developing small extensions using Chrome's various API's, and although things are working great, I'm still curious about a few things. Two questions, if you all wouldn't mind helping me out: 1. Could someone tell me what the limits are to chrome.storage.local's persistence? I've tried various tests on my own, such as storing a few things with chrome.storage.local.set(), clearing all of my browser history, cookies, etc. and then seeing if everything is still there. Often it

Inspect chrome.storage.sync while debugging Chrome extension

末鹿安然 提交于 2019-12-17 07:50:33
问题 Chrome DevTools has a handy inspector for Local Storage and Session Storage, but is there nothing to inspect chrome.storage.sync? chrome://sync-internals/ doesn't seem to display the actual contents of the synchronized storage per extension. 回答1: Storage Area Explorer extension provides a UI for viewing, editing, clearing, importing and exporting of chrome.storage.local , chrome.storage.sync , localStorage and sessionStorage : 回答2: A poor workaround is to call get and obtain all the stored

Inspect chrome.storage.sync while debugging Chrome extension

a 夏天 提交于 2019-12-17 07:50:29
问题 Chrome DevTools has a handy inspector for Local Storage and Session Storage, but is there nothing to inspect chrome.storage.sync? chrome://sync-internals/ doesn't seem to display the actual contents of the synchronized storage per extension. 回答1: Storage Area Explorer extension provides a UI for viewing, editing, clearing, importing and exporting of chrome.storage.local , chrome.storage.sync , localStorage and sessionStorage : 回答2: A poor workaround is to call get and obtain all the stored