smartinmedia/cunity

View on GitHub
lib/plugins/js/notifier.js

Summary

Maintainability
A
0 mins
Test Coverage
/**
 * This tiny script just helps us demonstrate
 * what the various example callbacks are doing
 */
var Notification = (function() {
    "use strict";

    var elem,
        hiddenHandler,
        that = {};

    that.show = function(text,type) {
        if(typeof elem === "undefined")
             elem = $('<span class="alert notification-alert hidden">Cunity-Notification</span>').appendTo("body");
        clearTimeout(hiddenHandler);

        elem.addClass("alert-"+type).html(text);
        elem.fadeIn().delay(4000).fadeOut().removeClass("alert-"+type);
    };

    return that;
}());