This question has already been answered:
There is a question that has tormented me for a long time. Functions like chrome.storage.sync have some kind of protection mechanism for something or just in the field of visibility, it is not clear.
I am writing an application, I have already asked questions about the method of saving data, but it is still necessary to reduce the code so that functions like chrome.storage.sync.get() or chrome.storage.sync.set() be protected into separate functions in something like designs:
function get_option_storage(option_name) { var result = false; chrome.storage.sync.get( option_name, function(func_result) { result = func_result; }); return result; } and for installation
function set_option_storage(option_name, option_value) { var result = false; chrome.storage.sync.set( {option_name: option_value}, function() { result = true; }); return result; } I came to this because of the high number of requests to save and read data from the repository, so I want to sew up methods of working with the repository into separate functions and call my own, how can this be done and is it possible at all?