Created
July 14, 2015 02:10
-
-
Save matugm/be30a3eeaeded0d8dad2 to your computer and use it in GitHub Desktop.
javascript refactor
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
// Old | |
$(function() { | |
var flashCallback; | |
flashCallback = function() { | |
return $(".alert").fadeOut(); | |
}; | |
$(".flash-message").bind('click', (function(_this) { | |
return function(ev) { | |
return $(".alert").fadeOut(); | |
}; | |
})(this)); | |
return setTimeout(flashCallback, 2000); | |
}); | |
// New | |
$(function() { | |
var flashCallback; | |
flashCallback = function() { | |
return $(".alert").fadeOut(); | |
}; | |
$(".flash-message").on('click', flashCallback); | |
return setTimeout(flashCallback, 2000); | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment