Skip to content

Instantly share code, notes, and snippets.

@matugm
Created July 14, 2015 02:10
Show Gist options
  • Save matugm/be30a3eeaeded0d8dad2 to your computer and use it in GitHub Desktop.
Save matugm/be30a3eeaeded0d8dad2 to your computer and use it in GitHub Desktop.

Revisions

  1. matugm created this gist Jul 14, 2015.
    29 changes: 29 additions & 0 deletions refactor.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,29 @@
    // 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);
    });