JavaScript
Build a Lens From Scratch
Let's take a backwards approach to dive into lenses by starting with our final implementation. What you see below is what we want our api to look like. We want prop to be a lens which can focus on a property and we…
Read moreExplaining Streams to Rich Harris
Before we begin, I'm intentionally avoiding loaded words found in stream libraries. If you're familiar with another library already, try and spot where the concepts align. Hi Rich! 👋 1. Start with an addEventListener…
Read moreFocused - Putting Proxies to Work
Focused With the power of our new proxy knowledge in hand, let’s turn to a library that leverages proxies behind the scenes. Focused is a library that uses similar techniques to get properties using proxies which…
Read moreIs an Observable Part of the Observer Pattern?
TL;DR No. Goodbye State 👋 In our previous post we defined observers as objects that take a subject and can pull the state in. With Observables , the concept of "state" is gone. We're now thinking in events (AKA…
Read moreWrap an API with a Proxy
codesandbox proxy api example
Read moreReplacing Named Parameters With Function Composition
A quick little https://egghead.io lesson if you're in to that sorta thing: Named parameters are a great feature of JavaScript, don't get me wrong, but sometimes functional composition is a more elegant solutions (I…
Read moreRxJS in Svelte
I'm really starting to ❤️ svelte . I've always loved using Observables from RxJS . The fact that I can easily combine them really excites me. I think that Svelte is one of the easiest ways to get an app up and running…
Read moreSafely Get Nested Values with Proxies
We've all been in the situation where we are trying to access a very deeply nested property inside of an object but it errors out because one of those properties you're trying to access is undefined. Strings to the…
Read moreUse Reflect APIs with Proxy Handlers
You'll notice something strange when you compare the Reflect API and the handler API for Proxies: Reflect API handler API Reflect.apply() handler.apply() Reflect.construct() handler.construct() Reflect.defineProperty…
Read moreWhat Is the Observer Pattern in JavaScript?
The Observer Pattern has state and objects that are notified when state changes so they can query the state. Check the State from the Observer First, the state is held inside of an object that we'll call a subject…
Read moreYour First JavaScript Proxy
A Proxy is a fancy word for intercepting how you interact with objects in JavaScript. Want to hi-jack what happens when you set a value? Care to log out every time you call a function? All this and much more can be…
Read more