jeudi 30 juillet 2015

JS Patterns Benefits

I have a quick question, for a recent app I need to namespace all functions and for that I've chosen this code:

var myObj = {
    prop: 1,
    method1: function() {
        // do something
    },
    method2: function() {
        // do else
    },
    initialize: function() {
        this.method2();
        this.method1();
    }
}

myObj.initialize();

Can someone tell if this is a pattern or other any other examples that I can use?

Aucun commentaire:

Enregistrer un commentaire