Last active
December 23, 2021 05:01
-
-
Save ridhotegar/bfa78e31c42491bac58e0d40c3c86de7 to your computer and use it in GitHub Desktop.
Wait all localStorage done with promise
This file contains 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
const localSet = (key, value) => { | |
return new Promise(resolve => { | |
resolve(localStorage.setItem(key, value)) | |
}) | |
} | |
Promise.all([ | |
localSet('KeyA', 'ValueA'), | |
localSet('KeyB', 'ValueB'), | |
localSet('KeyC', 'ValueC') | |
]).then(()=>{ | |
console.log(localStorage) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment