Skip to content

Instantly share code, notes, and snippets.

@gabrielmoreira
Created January 24, 2012 18:28
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gabrielmoreira/1671739 to your computer and use it in GitHub Desktop.
Save gabrielmoreira/1671739 to your computer and use it in GitHub Desktop.
POST: Sofrimento e aprendizado - Arquitetura de aplicações javascript
function Modal(target, options) {
this.target = target ;
this.options = options;
}
Modal.prototype.show = function() {
}
$.fn.modal = function(options) {
... // instanciar e armazenar o plugin --> new Modal($(this), options)
}
function Classe() {}
Classe.prototype.metodo = function() {}
new Classe();
function Classe() {
$.proxyAll(this);
}
Classe.prototype.metodo = function() {}
new Classe();
$.proxyAll = function(object, scope) {
scope = scope || object;
$.each(object, function(key, value) {
if ($.type(value) === 'function') {
object[key] = $.proxy(value, scope);
}
});
};
.valor { background-color: green }
.stateComErro .valor {background-color: red}
<TR class="stateComErro">
<TD></TD>
<TD class="valor"></TD>
</TR>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment