How to implement a lock in JavaScript

前端 未结 8 952
青春惊慌失措
青春惊慌失措 2020-12-04 07:49

How could something equivalent to lock in C# be implemented in JavaScript?

So, to explain what I\'m thinking a simple use case is:

User clicks

8条回答
  •  被撕碎了的回忆
    2020-12-04 08:24

    Locks are a concept required in a multi-threaded system. Even with worker threads, messages are sent by value between workers so that locking is unnecessary.

    I suspect you need to just set a semaphore (flagging system) between your buttons.

提交回复
热议问题