Understanding Angular Injection Context and Signal equality functionsDependency Injection (DI) is a pivotal design pattern that empowers developers to decouple their code, facilitating easier reuse of classes and services. In the context of Angular, DI plays a crucial role in supplying dependencies to components, dire...Aug 28, 2024·2 min read
JavaScript Design Patterns - Behavioral - StateThe state pattern allows an object to alter its behavior when its internal state changes. In this example, we create a simple state pattern with an Order class that will update the status with the next() method. const ORDER_STATUS = { waitingForPay...Aug 15, 2024·1 min read
JavaScript Design Patterns - Behavioral - ObserverThe observer pattern allows for the definition of one-to-many dependency between objects so that all its dependents are notified and updated automatically when one object changes state. In this example, we are creating a simple class product that oth...Aug 12, 2024·1 min read
Improve Angular Signals performance with untracked functionAngular Signals are available for developers from Angular v16. Signals provide a new way for developers to tell our templates (and other code) that our data has changed. We can think of a signal as a value plus a change notification. A signal is just...Jul 26, 2024·2 min read
JavaScript Design Patterns - Behavioral - MementoThe memento pattern allows capture and externalizes an object’s internal state so that the object can be restored to this state later. In the example below, we are creating a simple way to store values and restore a snapshot when needed. class Mement...Jul 19, 2024·1 min read
JavaScript Design Patterns - Behavioral - MediatorThe Mediator pattern allows us to reduce chaotic dependencies between objects by defining an object that encapsulates how a set of objects interact. The Mediator pattern suggests that we should cease all direct communication between the instances we ...Jul 10, 2024·1 min read
JavaScript Tag FunctionFollow MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals#tagged_templates Tagged Templates*— A more advanced form of template literals are tagged templates.* Tags*allow you to parse template literals with a fun...Jul 9, 2024·2 min read