Transcript from the "Changing View Based on User Interaction" Lesson
[00:00:53] Well, that's a bit of a shame. We're a bit out of space here. I really thought, could we put it down here maybe? I don't know. Not ideal, but we'll put it down here for now. So we had a call stack. This is a strange place to put it, but not the end of the world.
[00:01:57] Is there any code still running here? No, you bet there is not. At one minute there is no code still running here. And so, we are going to have our handle click function added by our event loop that checks is there any code running to our stack of functions, list of functions roughly list, that are gonna execute.
>> Execution context.
[00:03:21] And that is gonna happen at the exact moment that the user starts inputting, or starts clicking, clicks, sorry. And so, we know when this runs that we can make changes to what the user sees based on the user's action. But I've gotta follow that through. So the user type, these are clicks.
[00:03:41] I'm purposely finding this difficult I promise. The user clicks and that's going to change the input default text because we want. When it's currently got text in it to remove that text, okay. That is called, what I just did there, that scene was called a reason was reasoning about state and view.
[00:04:33] And then we're doing that again here with an empty string, but that's us reasoning about how things the user sees will change. So with that in mind, JSInput, value is equal to empty string. Who would like to give a shot at verbalizing that? Ian, can you give me a shot at verbalizing that in terms of our input element on the DOM here?
>> So when we, that is in handle click line 12, right?
>> Yeah, handle click, we're in handle click, exactly right.
>> So JS input is gonna be our accessor object for that input that we queried earlier.
>> And we're accessing the setter for value.
>> Yep, perfect.
>> And we're signing into an empty string literal. Rule.
>> Beautiful. And there it is.
>> And that's the way to go over to the DOM and C++ land. And because it's an accessor object, it's gonna happen over there,
>> Yes, exactly set the value to an empty string, which is then going to do what are the actual pixels on the page?
>> We will end up with not pixels where they used to be.
>> Yes, exactly. No pixels where there were pixels. Beautiful and that is our handle click finished.