In a scenario where I have 2 buttons, but_A and but_B.
but_A.onMouseClicked(chrome.storage.local.set({"key": "A"}, function(){
console.log("but_A val set"); }));
but_A.onMouseClicked(chrome.storage.local.set({"key": "B"}, function(){
console.log("but_B val set"); }));
If I click but_A, then but_B, what will the value corresponding to "key" be? Will the behaviour be deterministic?
I reasoned so far that:
when A is pressed, the first chrome.storage.local.set()
will enter the message queue, popped to stack and execute. While the .set()
for A is still executing, B is pressed. The .set()
for B will also execute. Will the two chrome.storage.local.set()
run simultaneously on two separate threads?
Thank you!