Debugging and Web Components and NodeBots, oh my!
I’d like to blame it on the dog, but she’s doing alright. Mostly, I just haven’t made time for myself to write this past week. I have a reminder on my calendar but I ignore it. So what good does it do then? Blech. This has been a pretty good week though, all things considered. Just distracting because of dog and other family stuff. You know. Life.
I learned last Tuesday, at our local web developer meetup, that Google’s AMP project uses Web Components behind the scenes. What a neat technology stack that is! I’ve been using Web Components at work, so this was a great opportunity to learn by comparing implementations. One thing I really like about AMP’s implementation is their more granular lifecycle methods. The documented lifecycle methods that are available to custom elements include callbacks for element registration and insertion, as well as element removal and attribute changes. AMP expands this to include many other methods, including a firstAttachedCallback which only is run the first time the element is inserted in the DOM, a layoutCallback when elements are first laid out (or every time, depending on implementation), viewportCallback that runs when elements enter or exit the viewport, pauseCallback and resumeCallback that initially seem to be useful for things like video but could be used for making things active/inactive, and an unlayoutCallback for freeing up resources on an element being removed.
Outside of work-related things, I’ve gotten a new student with Thinkful and we’re covering material for Node.js, which is a blast. Debugging is a bit frustrating in Node, but it’s fun watching someone struggle and then figure things out. It is a supremely rewarding process to be a part of. Thankfully a lot of what we’re working on builds on prior learnings from earlier in the curriculum. So now we’re not only consuming an API with a front-end application as learned earlier in the course, but now we’re *building* one! Thankfully frameworks like Express make this task pretty straightforward. Soon we’re going to dive into Mongo to add a database layer to the application.