Unlimited Plugins, WordPress themes, videos & courses! Unlimited asset downloads! From $16.50/m
  • Overview
  • Transcript

1.2 Create a New JavaScript Framework: How We Built the Daily Mail CMS

In this lesson, I’ll explain why the Daily Mail team decided to roll their own JavaScript framework. We’ll take a look at the scope of the project, its requirements, and why the Daily Mail didn’t think any of the existing frameworks would be a good solution.

After that, I’ll show you some of the features that make the Milo framework unique, such as its powerful models, deep two-way data binding, and facetted component architecture.

Code Snippet

The following snippet demonstrates the interface for data i/o for Milo models.

var m = new milo.Model();
m('.a.b.c[3].d').set('Safe deep data access.');
m.on('.a.b.c[*]', function (msg, data) {
    //Deep data change subscriptions including wildcards
});

Now, to establish a data binding between the model and a UI component, all that’s needed is a call to Milo’s data minder. The following snippet establishes a two-way binding, two levels deep (e.g. between arrays of objects).

milo.minder(m, '<<<->>>', todos.data);

Below is an example of how to declare a Milo component. This showcases Milo’s facetted component architecture, a strategy that allows for versatility and flexible composition of functionality.

var ComponentClass = milo.createComponentClass({
    className: 'ComponentClass',
    facets: { 
        data: {}, // empty object or undefined means no config needed
        item: {},
        css: {
            classes: { // css facet is linked to the model to allow
                       // data driven design
                '.userHandle': isAuthor
            }
        }
    },
    methods: {
        init: init,
        start: start
    }
});

Related Links

1.Create a New JavaScript Framework: How We Built the Daily Mail CMS
2 lessons, 11:57

Free Lesson
1.1
Introduction
00:42

1.2
Create a New JavaScript Framework: How We Built the Daily Mail CMS
11:15


1.2 Create a New JavaScript Framework: How We Built the Daily Mail CMS

Back to the top