Last active
December 14, 2015 19:08
-
-
Save eduardo-matos/5134138 to your computer and use it in GitHub Desktop.
Disparando eventos com jQuery
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
function CentralDeProdutos () { | |
$(this).on('adicionado', function (evt, sucesso) { | |
alert('Removido com sucesso: ' + sucesso); | |
}); | |
$(this).on('removido', function (evt, sucesso, numeroProdutosRemovidos) { | |
alert('Removido com sucesso: ' + sucesso); | |
alert('Número de produtos removidos: ' + numeroProdutosRemovidos); | |
}); | |
} | |
CentralDeProdutos.prototype.add = function () { | |
$(this).trigger('adicionado', [true]); | |
} | |
CentralDeProdutos.prototype.remove = function () { | |
$(this).trigger('removido', [true, 3]); | |
} | |
var central = new CentralDeProdutos(); | |
central.add(); | |
central.remove(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment