I wanna inject a content script to pages with a method with two parameters. Since the Chrome.storage.local.get()
is asynchronous, I have to make sure that all parameters are initialized from the chrome.local.storage
and then begin to invoke my method.
Now I can get only one parameter every time with code like :
var parameter1;
storage.get('parameter1', function(items) {
parameter1 = items.parameter1;
if (parameter1) {
//do sothing
}
});
var parameter2;
storage.get('parameter2', function(items) {
parameter2 = items.parameter2;
if (parameter2) {
//do sothing
}
});
But this is not enough to call my method which contains 2 parameters:
function myMethod(parameter1, parameter2);
So how to get and retrieve them ?
If anyone comes back here in 2021 :)