Created
December 16, 2010 10:28
-
-
Save rwz/743264 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// тупо | |
var wiget = new Class({ | |
// ... | |
getSomething: function(){ | |
if (this.something) return this.something; | |
this.something = new Element('div'); | |
// тут километры кода | |
return this.something; | |
} | |
//... | |
}); | |
// более прикольно | |
var wiget = new Class({ | |
// ... | |
something: function(){ | |
var something = new Element('div'); | |
// километры кода | |
this.something = function(){ return something }; | |
return something; | |
} | |
// ... | |
}); | |
// совсем ништяк | |
var wiget = new Class({ | |
Memorize: [ 'something' ], | |
// ... | |
something: function(){ | |
var something = new Element('div'); | |
// километры кода | |
return something; | |
} | |
// ... | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment