javascript - Requesting data from storage in Chrome extension -


i using chrome storage api, has method chrome.storage.local.get('key');

my program going store list of data in each day.

what type of data i'm storing (not important)
if user browse facebook.com n minutes , google.com m minutes in 2016/7/28, i'll store "facebook.com||n::google.com||m" in key "2016/7/28". '::' seperates each data '||' seperate domain , time.

what's problem

the set of data may grow large number, , 1 of program feature request uncertainly many (any natural number) date data storage.

considering:

1. number of days requested uncertain, data shouldn't store in single key. or, i'll need pull huge amount of data storage if request single day, seems absolutely idiot.

2. but! if program request 100+ or more data storage, i'll need call chrome.storage.local.get('date'); method each date. i'm not sure how method implemented , whether can complete such crazy task. if could, i'm not sure whether should chain 100+ callbacks altogether (seems powerful bomb).

3. or, should give feature , force user choose limited options (ex: can choose 10, 50, 100, 365 days). in case, need manage data structure each option. seems not cool :(

i prefer case 1 or 2 case 3. or, there possible solution situation?
thanks!

chrome.storage.local.get accepts array keys, wrap 100+ date array, [day1, day2, ..., day100],

chrome.storage.local.get([day1, day2, ..., day100], function (result) {     var day1 = result.day1; }); 

btw, if data big enough, consider unlimitedstorage permission.


Comments

Popular posts from this blog

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -

Combining PHP Registration and Login into one class with multiple functions in one PHP file -