SOURCE

var orignalSetItem = localStorage.setItem;
    localStorage.setItem = function(key,newValue){
        var setItemEvent = new Event("setItemEvent");
        setItemEvent.key = key;
        setItemEvent.newValue = newValue;
        setItemEvent.oldValue = localStorage.getItem(key);
        window.dispatchEvent(setItemEvent);
        orignalSetItem.apply(this,arguments);
    }
    window.addEventListener("setItemEvent", function (e) {
        console.log('key: '+e.key);
        console.log('newValue: '+e.newValue);
        console.log('oldValue: '+e.oldValue);
    });
    localStorage.setItem("nm","1234");
console 命令行工具 X clear

                    
>
console