Decoupling JS apps using publisher subscriber pattern The problem Let me use one of the most common features in modern web applications to introduce the problem: sending notification emails. Let’s say we’re building an e-commerce site and we’d like to send a notification email to the customer when they make a purchase. A simple solution, and probably the most common […]

Constructor Pattern (js)

Before es6, JavaScript doesn’t support the concept of classes but it does support special constructor functions that work with objects. By simply prefixing a call to a constructor function with the keyword “new”, we can tell JavaScript we would like the function to behave like a constructor and instantiate a new object with the members […]