logo
episode-header-image
Aug 2023
22m 28s

JS Fundamentals - Decorators

Wes Bos & Scott Tolinski - Full Stack Javascript Web Developers
About this episode

In this Hasty Treat, Scott and Wes talk about whether decorators are finally here, what the uses cases are for decorators, how to define a decorator, and what auto accessor is.

Show Notes

on classes

@loggged class C {} 

on fields

class C { @logged x = 1; } 

Auto Accessor

class C {   accessor x = 1; } 

sugar for below

class C {   #x = 1; // # means private    get x() {     return this.#x;   }    set x(val) {     this.#x = val;   } } 

Can be decorated and decorator can return new get and set and init functions

function logged(value, { kind, name }) {   if (kind === "accessor") {     let { get, set } = value;      return {       get() {         console.log(`getting ${name}`);          return get.call(this);       },        set(val) {         console.log(`setting ${name} to ${val}`);          return set.call(this, val);       },        init(initialValue) {         console.log(`initializing ${name} with value ${initialValue}`);         return initialValue;       }     };   }    // ... } 

Tweet us your tasty treats

Up next
Jul 9
918: Extreme Native Perf on the Web with Superhuman
Wes and Scott talk with Loïc Houssier about how Superhuman builds lightning-fast, delightfully-designed email software. They dig into engineering philosophy, offline-first architecture, local databases, AI-powered productivity, and what it takes to create tools that people love. ... Show More
48m 54s
Jul 7
917: AI Tools You Should Know
Scott and Wes round up the hottest AI tools you should have on your radar; from text-to-speech wizards to self-hosted image generators. They break down what they’re using, what’s worth paying for, and which tools are changing their workflows. Show Notes 00:00 Welcome to Syntax! 0 ... Show More
37m 48s
Jul 2
916: I got fired, what should I focus on?
In this potluck episode of Syntax, Wes and Scott answer your questions about maintaining popular open-source projects, where to start after a layoff, impostor syndrome, Scott’s recording setup, whether a computer science degree is still worth it in the age of AI, and more! Show N ... Show More
58m 24s
Recommended Episodes
Feb 2019
S1E12: Really alarming breakpoints
In this episode: Xcode ships with a Swift 5 beta, Apple smacks down Facebook and Google, we discuss the value of design, and talk about important knowledge for iOS developers. - Xcode 10.2 includes an early Swift 5 version: https://developer.apple.com/documentation/xcode_release_ ... Show More
29m 26s
Nov 2020
React, Vue, jQuery: what flavor do you like your Vanilla JS?
You can find Ferdinandi's post and video here.12 years ago, back when Stack Overflow was a brand new site with just a few thousand users, someone asked a basic question: What is the difference between a framework and a library?FreeCodeCamp has its own take on this question with a ... Show More
16m 22s
Feb 2022
Is functional programming the hipster programming paradigm?
Here’s a useful primer on functional programming with JavaScript.This tutorial will guide you in exploring the fundamentals of functional programming with React.If you’re looking for more info on functional programming in React, we’d like to tell you why hooks are the best thing ... Show More
27m 49s
Nov 2023
What's new in CSS land
Una Kravets, developer advocate at Google & web platform ambassador, joins Amal & Nick to take them CSS to school as they start this podcast in CSS kindergarten and end it with a Level-Up CSS Diploma. (LUCD?) We explore all the amazing features which have recently landed in CSS — ... Show More
1h 14m
Feb 2024
Angular Signals
KBall & Amal interview Alex & Pavel from the Angular Signals team. They cover the history, how the Angular team decided to move to signals, what the new mental model looks like, migration path & even dive into community integrations and future roadmap. Leave us a comment Changelo ... Show More
1h 6m
May 2019
Chris Lattner: Compilers, LLVM, Swift, TPU, and ML Accelerators
Chris Lattner is a senior director at Google working on several projects including CPU, GPU, TPU accelerators for TensorFlow, Swift for TensorFlow, and all kinds of machine learning compiler magic going on behind the scenes. He is one of the top experts in the world on compiler t ... Show More
1h 13m
Jun 2023
S5 E16 | Pushing the Boundaries of Angular with Brandon Roberts
If someone says it can't be done in Angular, you can bet Brandon Roberts has a branch going to prove that indeed it can. In this week's episode, we talk Analog Js with Brandon and all of the parts that needed to come together to build this full stack Angular meta-framework. Twitt ... Show More
1h 9m
Apr 2023
S5E9 | RxJs and Signals Interoperability in Angular with Ben Lesh
Signals are coming to Angular! So what does that mean for RxJs? In this episode we invite Ben Lesh to get his take on what the Signals story means for RxJs and Angular. How can Signals and RxJs work together, when one might be the better tool, and what bad patterns should develop ... Show More
1h 14m
Apr 2024
A+ Show S7 E9 | Signals and Observables | Lamis Chebbi
There's probably not a single topic that is more widely discussed in the Angular Community than Signals and Observables right now. Lamis Chebbi shares her perspective on this topic and provides valuable insights and lessons learned!  Her book is available on Amazon: Reactive Patt ... Show More
1h 5m