Created
January 16, 2013 21:18
-
-
Save muriloadriano/4551060 to your computer and use it in GitHub Desktop.
This file contains 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
// Algumas vezes precisamos criar uma classe que utilizaremos apenas | |
// uma vez (um objeto) e nunca mais, poluindo o espaco de nomes | |
// e dando mais trabalho | |
class MyClickable implements Clickable { | |
function onClick() { | |
showOnScreen(); | |
} | |
} | |
var a = MyClickable.new(); | |
foo(a); // depois disso nunca mais usa a | |
------- | |
// Poderia ser assim: | |
foo(Clickable.new { | |
function onClick() { | |
showOnScreen(); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment