Learning JavaScript Design Patterns P.2 (ok)
https://addyosmani.com/resources/essentialjsdesignpatterns/book/#introduction
Mediator Pattern
var mediator = {};var orgChart = {
addNewEmployee: function(){
// getEmployeeDetail provides a view that users interact with
var employeeDetail = this.getEmployeeDetail();
// when the employee detail is complete, the mediator (the 'orgchart' object)
// decides what should happen next
employeeDetail.on("complete", function(employee){
// set up additional objects that have additional events, which are used
// by the mediator to do additional things
var managerSelector = this.selectManager(employee);
managerSelector.on("save", function(employee){
employee.save();
});
});
},
// ...
}Prototype Pattern

Command Pattern
Facade Pattern
Factory Pattern

Abstract Factories
Mixin Pattern
Sub-classing

Mixins

Decorator Pattern
Example 1: Decorating Constructors With New Functionality
Example 2: Decorating Objects With Multiple Decorators
Pseudo-classical Decorators
Interfaces
Abstract Decorators
Decorators With jQuery
PreviousLearning JavaScript Design Patterns P.1 (ok)NextLearning JavaScript Design Patterns P.3 (ok)
Last updated