Last active
January 18, 2023 09:53
-
-
Save rony-arnac/a0235a2aa7c1d6009b3873bb71988d5e to your computer and use it in GitHub Desktop.
example of how Alice and Bob can overwrite each other's data
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
/** | |
* data = { | |
* balance: 100, | |
*. addresses: ['0x1', '0x2'] | |
* } | |
*/ | |
// Alice (1) | |
const aliceData = await getComplexData(); | |
// Bob (1) | |
const bobData = await getComplexData(); | |
// Alice (2) | |
aliceData.balance = 90; | |
await setComplexData(aliceData); | |
// Bob (2) | |
bobData.addresses.push('0x3'); | |
await setComplexData(bobData); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment