4

小さなChrome拡張機能を作成しています。使いたいのですがchrome.storage、ストレージから複数のアイテム(配列)を削除することができません。単一のアイテムの削除が機能します。

function clearNotes(symbol)
{
    var toRemove = "{";

    chrome.storage.sync.get(function(Items) {
        $.each(Items, function(index, value) {
            toRemove += "'" + index + "',";         
        });
        if (toRemove.charAt(toRemove.length - 1) == ",") {
            toRemove = toRemove.slice(0,- 1);
        }
        toRemove = "}";
        alert(toRemove);
    });

    chrome.storage.sync.remove(toRemove, function(Items) {
        alert("removed");
        chrome.storage.sync.get( function(Items) {
            $.each(Items, function(index, value) {
                alert(index);           
            });
        });
    });
}; 

何も壊れていないように見えますが、ストレージにあるものを警告する最後のループには、削除しようとしているすべての値が表示されます。

4

1 に答える 1