JavaScript synchronization options

前端 未结 6 880
庸人自扰
庸人自扰 2021-02-04 13:44

I was wondering whenever exists a solution to perform synchronization in JavaScript code. For example I have the following case: I\'m trying to cache some response values from A

6条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-02-04 13:51

    Javascript is inherently single-threaded, at least for the normal browser environment. There will never two simultaneous executions of scripts accessing the same document. (the new Javascript worker threads might be an exception here, but they're not meant to access documents at all, just to communicate by message passing).

提交回复
热议问题