an alternative naming shared with the Adapter pattern) is a design pattern that allows behaviour to be added to an individual object, either statically or dynamically, without affecting the behaviour of other objects from the same class. The decorator pattern is often useful for adhering to the Single Responsibility Principle, as it allows functionality to be divided between classes with unique areas of concern. -Wikipedia WHAT IS THE DECORATOR PATTERN?
enhancements ➤ Shared documentation and tooling ➤ Statically analysed by IDEs, type-checkers (like Flow, Typescript) and documentation generators (like ESDoc) ➤ Classes are first class citizens in Javascript *pun intended*
arguments ➤ Doesn’t work with {{link-to}}, {{input}} and {{textarea}} {{#link-to "about"}}About Us{{/link-to}} <LinkTo @route="about">About Us</LinkTo>
date; constructor() { setInterval(() => (this.date = new Date()), 1000); }, get formattedTime() { return moment(this.date).format('h:mm:ss a'); } get message() { return `It is currently ${this.formattedTime}!`; } } If you change a class field and want the DOM to update, Make it tracked.