Created
September 5, 2022 04:34
-
-
Save sabesansathananthan/b117da0bee8fb0ae11e9d77b5a5f4fc0 to your computer and use it in GitHub Desktop.
How to override methods in localStorage?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MyLocalStorage { | |
setItem(key, value) { | |
console.log('MyLocalStorage.setItem', key, value); | |
localStorage.setItem(key, value); | |
} | |
} | |
const myLocalStorage = new MyLocalStorage(); | |
myLocalStorage.setItem('aa', '123'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment