Js multiple concurrency problem (a problem with some depth)

scenario: two pages are independent of each other, and the JavaScript code in them executes independently of each other. The js of these two pages share a common variable shareArray array in localStorage

Action
1, page A stores a piece of data in shareArray
2, page B deletes a piece of data from shareArray

question:
from the above point of view, it has satisfied the concurrency problem caused by adding and modifying a common variable at the same time in case of multiple concurrency. What I want to know is how the front end handles such a problem and ensures data consistency in extreme cases

.
Nov.04,2021

if concurrency must be achieved through Storage, using StorageEvent is a better way

of course, a better option is to use IndexDB, which has a transaction mechanism

Menu