'chrome.storage save only changed data

I'm developing a Chrome extension and I'm both saving and restoring data with chrome.storage.

Since there is more than one data, every time I need to save data, I re-save all the data. How do I get the data needed to be saved instead?

How do I need to update the function?

function setStorage() {
    chrome.storage.sync.set({"theme_color": $id("input_theme_color").value}, function() {
    });
    chrome.storage.local.set({"history_content": historyContent}, function() {
    });
    chrome.storage.sync.set({"settings_update": lastSettingsUpdate}, function() {
    });
    chrome.storage.local.set({"last_history_clear": lastHistoryClear}, function() {
    });
    chrome.storage.local.set({"total_history_content": totalHistoryContent}, function() {
    });
    chrome.storage.local.set({"last_music": lastMusic}, function() {
    });
}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source