I want some data stored in Local storage to content script page. As its not directly available, I did it through chrome.runtime.sendMessage
But I have several values and looks like this.
var username, apikey, openexchange, currency, locale;
chrome.runtime.sendMessage({method: "getLocalStorage", key: "username"}, function(response) {
username = response.data;
});
chrome.runtime.sendMessage({method: "getLocalStorage", key: "apikey"}, function(response) {
apikey = response.data;
});
chrome.runtime.sendMessage({method: "getLocalStorage", key: "openexchange"}, function(response) {
openexchange = response.data;
});
chrome.runtime.sendMessage({method: "getLocalStorage", key: "currency"}, function(response) {
currency = response.data;
});
chrome.runtime.sendMessage({method: "getLocalStorage", key: "locale"}, function(response) {
locale = response.data;
});
When values increasing, this list will go further, Instead Is there any other method to wrap all value in just one function?
Any help would be appreciated.