Hi all please let me know the meaning of following statement
addEvent(window, 'storage', function (event){
if (event.key == 'storage-event-test'){
output.innerHTML = event.newValue;
}
});
addEvent(dataInput, 'keyup', function (){
localStorage.setItem('storage-event-test', this.value);
});
Please explain me what is addEvent() method and what does above code does.
There is no addEvent method as part of javascript, could be an externally written function. There is element.addEventListener
From your code the addEvent expects this signature:
The first parameter I’m not sure about, just takes an object. The second is a string representing (I’m guessing) the event and the third is a function that is called when the event happens.
See here for more about local storage.