0

I was learning how zone.js monkey-patches browseraAPI(basically async tasks), and fork hooks to notify when an activity starts and ends.

setTimeOut is browserAPI not a javascript thing, so Zone can patch it but how about onclick, onkeydown.............. events? As per my understanding , zone patches only browser APIs then how change detection is getting triggered when i do button click or a keydown or any user interaction?

Or my nderstanding is wrong. Zone can patch any event?

3
  • The DOM (and it's associated event model) is not part of JavaScript (nor is it unique to JavaScript). And generally speaking, in JS-land you can overwrite almost anything. Commented Jun 21, 2018 at 20:15
  • One more confusion i have. I know resize,scroll and animation are browser events but how will you catigorize onclick,keydown,........user event or what? And also , this onclick , keydown.. these are browser API or Javascript API? And also as i know setTimeout is browser API, but we write it in javascript. How things are working behind the scene. So how javascript interacting with the API exposed by browser?What is the wrapper Object here? Commented Jun 22, 2018 at 20:03
  • Check out my answer here, that will probably clear up a lot of your confusion. Short answer is: it doesn't matter, and unless you are looking to author your own web browser you probably needn't concern yourself with the difference. Commented Jun 25, 2018 at 13:07

1 Answer 1

0

onclick,onkeydown is also patched as addEventListener. So everything handled inside eventHandler will also auto trigger Change Detection.

Sign up to request clarification or add additional context in comments.

2 Comments

One more confusion i have. I know resize,scroll and animation are browser events but how will you catigorize onclick,keydown,........user event or what? And also , this onclick , keydown.. these are browser API or Javascript API? And also as i know setTimeout is browser API, but we write it in javascript. How things are working behind the scene. So how javascript interacting with the API exposed by browser?What is the wrapper Object here?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.