jquery javascript design: self executing duty vigilant literal?
i'm extraordinary there any best practices relating jquery constructing encapsulated formula blocks.
generally, i make page i encapsulate functions used within page inside an object. allows me encapsulation building applications. there's zero i loathing some-more observant javascript record garland this
function dosomethingonlyrelevantonthispage() {
// stuff
}
i creates unfinished design, doesn't unequivocally encapsulate functionality nicely.
commonly frameworks, there customary used perform encapsulation.
in mootools preference vigilant verbatim notation:
var site = {
// properties methods
}
in yui preference self executing duty notation:
(function() { // properties methods })()
the good thing second instance closure created, so permitting interpretation private properties methods.
my doubt this: any jquery aficionados have any best practices formulating purify encapsulated structures? martial behind use?
Comments
Post a Comment