A solution to work in large JavaScript projects with Mediator Design Pattern in a modular way.
While working in grown projects you may try to find a solution to structure your JavaScript in a maintainable way. One possibility is to use a MV* framework like Backbone, Ember or Angular. A different/extended solution tries to be modular. With the Mediator Design Pattern this is easily achieveable.
Because it is good to not reinvent the wheel everytime you code something, download/clone mediator.js from Github. It is a free MIT licensed library with the Design Pattern already implemented.
Let me show you an example usage with a simple module that calculates the square of a rectangle. Let us start with the following HTML...
Your new post is loading...