What is Nostr?
dolu /
npub1txu…phrl
2025-02-03 14:42:32
in reply to nevent1q…030l

dolu on Nostr: I don't know the context of your post, but of course mutex is useful in JS. If you ...

I don't know the context of your post, but of course mutex is useful in JS.
If you have an async function inside your function, you could need a mutex

Simple example is spend money, call this function 2 times in a short time and your user could spend money he doesn't have

async function spendMoney(amount) {
const balance = await getBalance()
if (balance > amount)
await spend(amount)
}
Author Public Key
npub1txukm7xckhnxkwu450sm59vh2znwm45mewaps4awkef2tvsgh4vsf7phrl