Event Loop Video Blogamajigger

I got m’whiskey, I got m’cats, I’m gonna watch this Event Loop video. I wanted to have a little intro dealie before watching it, try and put my thoughts down about Event Loops before watching a video about it. Maybe I can go into it with questions and some measure of context before learning more about it, that sort of approach has helped me in the past. So the way that I understand an Event(capitalization unnecessary I know, but it helps me quickly identify jargon words), is that it is any action that occurs during the running of code. It could be a key pressing, it could be prompted by particular changes on the client-side of things, maybe an event if even any input into the web page by the client. I’m not a hundred percent sure yet, maybe the video will clear that up. By using the term Event Loop, maybe that means there are multiple things(or Events, rather) happening in sequence once an input is registered. Like, you press a ‘Fire’ button in a Galaga-type app, and not only is a little bubble generated on the front of your ship, but that bubble’s parameters change and move about the page, eventually coming into contact with an alien ship, which is then ‘destroyed’, removing the alien ship from the field of play and also registering a score on the UI. I may just be talking out of my ass here, though. I’m planning on watching the video on my big ol’ TV in my living room, and recording my thoughts as it goes here on my laptop, sort of, I guess, translating it into words and concepts my monkey brain can comprehend. Let’s get whisky! I mean, started!

Last thing before watching the video-the description of the video is pretty encouraging. It looks like the narrator will take a universal or simple approach to the explanation, and I’m a big fan of that. Monkey like simple.

Philip Roberts. Good strong name. I like his chin. His computer has some fun stickers on it. I can’t quite place his accent, kind of Minnesota-ish. He seems to have the same questions I have about JS, like, you know, how it works in general. He doesn’t know what v8 is, and I sure as hell don’t either, but apparently it has to do with JS somehow. V8 is the run-time in Chrome, cool. Heap is where memory allocation happens, which is good. Then something about stack. He introduces webAPI’s, which I’m hoping he’ll expound on later. So it looks like he’s gonna talk about the call stack first in detail. JS is a single-threaded program, it does one thing at a time, which I knew. Like, it goes character by character, line by line, etc. I like this approach a lot, it takes a lot of guesswork out of the process, and everything is pretty firmly in relation to each other, from top to bottom. He’s visualizing the Call Stack, which luckily I feel like I already got, but it’s still good stuff. Ooh, new term, ‘Blocking’. This could be juicy. He’s talking about when the stack gets too thick, too juicy, like putting too many patties on a burger. Even though it’s delicious, it’ll take forever to eat, because too many patties. He makes a connection between Blocking and browsers. Oh cool, he makes the point that you can’t do anything until a process is completed, but it still registers that these things happened, it just runs that script after the ‘Blocked’ process finishes itself.

Okay, now he’s talking about Asynchronous Callbacks. I remember Justin showing us this dealie in class, let’s see how much I remember and whatnot. So, we’re talking about how a timeOut function makes a callback function in the Stack run not immediately, but later, so it actually leaves the Stack until the pre-determined amount of time has elapsed. The timeOut function leaves the stack and enters the task queue(that’s a ridiculous word by the way. It’s 80% vowel. That’s too much vowel.). I dig it, yo. The main thing I’m taking from this right now is that the callstack has to clear before the callback loop can actually enter the task queue.

This is a very charming man. I like his animation of his code lighting on fire and all dying.

I really like the callback queue bit. Lag in games make so much more sense to me now, like the rubberband effect or how that prick was able to kill me in Halo even though I CLEARLY SHOT HIS STUPID FACE FIRST whatever screw you Xx420PirateNiNjAxX. Anyway.

He shows the difference between synchronous and A-syn callbacks, and I’m not sure the benefit of using an A-syn callback with a 0 ms timeOut. Wait, he’s explaining it now. I’m not a patient man. Apparently no render can happen with shit on the stack. I’m sure that’s useful later. OH, cool! So, the neat thing about A-syn is that you can do other stuff while the A-sync’d callbacks run from their queue to the Call Stack! Neat!

I just paused since a totally cute girl texted me and, you know, priorities, and I just realized this video is not about Event Loops at all. The presentation name is just a humorous reference to a common question asked by JS programmers to highlight the underlying issues of JS function. It’s like if a video on how an internal combustion engine was constructed was titled “Why does my Engine smell like Burnt Ass?”. Pro tip-because you need to change your oil more than once every 20000 miles, Dad. Anywho, resuming playback.

I’m seeing a lot of $. Reminder to myself to google that later.

I like his shirt. I’d wear that shirt. Oh, he’s done.

Ok, so, what did I learn? What was the goal going into this, and was that goal achieved?

The goal was to gain a better understanding of the inner workings of JS, like where code goes to be executed in the browser, and in what order, etc. I do feel like I have a pretty good grasp of that, and you know what? I think I’m gonna start taking all my notes in class like this, on Medium, so that it forces me to really listen(because APPARENTLY I’m not doing well enough at that, per my 2-week evaluation), and to try and absorb the material as well as possible.

I hope this post isn’t too long. Justin didn’t exactly put a length requirement on it. Anyway, video over, call stack, web api’s, callback queue, yeah. Good stuff. Good chin. Good shirt.

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.