Issue
I'm studying Javascript and I became curious how Javascript catch an event in linear execution.
For example, in AngularJS I can write simple multiplication website that has two input boxes and one output box. Two "controller" codes that detect changes in respective two input boxes are created.
But to my knowledge JS runs linearly, so when the second "controller" is running the first "controller" would be unable to detect any change.
Solution
Events are queued in a message queue, so after an event has been handled, the next event will be processed (simplified):
https://developer.mozilla.org/en-US/docs/Web/JavaScript/EventLoop
Answered By - Sebastian B.
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.