mardi 10 mai 2016

Is this a valid pattern and what is it called?

When I am working with a lot of variables in PHP or JS I will normally just attach them to a single object and pass that to the function.

I do this instead of listing each variable separately in the function defenition. This takes advantage of the dynamic nature of the language?

Is this a valid pattern and does it have a name? If not how should the code be re-written?

// Used by picture
popOut: function (obj) {
    var self = this;
    self.populate(obj.response_element, obj.state);
    // self.hideInput(true, obj);
    Animate.popUp(obj.response_element, {callback: function () {
        // self.hideInput(false, obj);
    }});

},

Aucun commentaire:

Enregistrer un commentaire