- After-Shows
- Alternative
- Animals
- Animation
- Arts
- Astronomy
- Automotive
- Aviation
- Baseball
- Basketball
- Beauty
- Books
- Buddhism
- Business
- Careers
- Chemistry
- Christianity
- Climate
- Comedy
- Commentary
- Courses
- Crafts
- Cricket
- Cryptocurrency
- Culture
- Daily
- Design
- Documentary
- Drama
- Earth
- Education
- Entertainment
- Entrepreneurship
- Family
- Fantasy
- Fashion
- Fiction
- Film
- Fitness
- Food
- Football
- Games
- Garden
- Golf
- Government
- Health
- Hinduism
- History
- Hobbies
- Hockey
- Home
- How-To
- Improv
- Interviews
- Investing
- Islam
- Journals
- Judaism
- Kids
- Language
- Learning
- Leisure
- Life
- Management
- Manga
- Marketing
- Mathematics
- Medicine
- Mental
- Music
- Natural
- Nature
- News
- Non-Profit
- Nutrition
- Parenting
- Performing
- Personal
- Pets
- Philosophy
- Physics
- Places
- Politics
- Relationships
- Religion
- Reviews
- Role-Playing
- Rugby
- Running
- Science
- Self-Improvement
- Sexuality
- Soccer
- Social
- Society
- Spirituality
- Sports
- Stand-Up
- Stories
- Swimming
- TV
- Tabletop
- Technology
- Tennis
- Travel
- True Crime
- Episode-Games
- Visual
- Volleyball
- Weather
- Wilderness
- Wrestling
- Other
JS Fundamentals - Decorators
Podcast: Syntax - Tasty Web Development Treats (LS 61 · TOP 0.1% what is this?)
Episode: JS Fundamentals - Decorators
Pub date: 2023-08-14
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 00:25 Welcome 01:00 Are decorators finally here? TC39 proposal How this compares to other versions of decorators 06:47 What are use cases for decorators? 10:55 How do you define a decorator? 14:20 Auto Accessor 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 Scott’s Instagram LevelUpTutorials Instagram Wes’ Instagram Wes’ Twitter Wes’ Facebook Scott’s Twitter Make sure to include @SyntaxFM in your tweets Wes Bos on Bluesky Scott on Bluesky Syntax on Bluesky
The podcast and artwork embedded on this page are from Wes Bos & Scott Tolinski - Full Stack JavaScript Web Developers, which is the property of its owner and not affiliated with or endorsed by Listen Notes, Inc.