lmaccherone / node-localstorage

A drop-in substitute for the browser native localStorage API that runs on node.js.
MIT License
450 stars 36 forks source link

How to use listener? #48

Closed enriquepiatti closed 4 years ago

enriquepiatti commented 4 years ago

Hi, can you provide some example using the event listeners? Thanks !!

enriquepiatti commented 4 years ago

OK, this works:

localStorage.on('storage', function(e){
        const key = e.key;
        const newValue = e.newValue;
        const oldValue = e.oldValue;
    });
lmaccherone commented 4 years ago

I see that you got it working on your own, but I'm curious if the way it worked was not the same way as the native LocalStorage or somehow was not as expected?