From 0e89ca1fafdba644ea13633a039f9b89241af581 Mon Sep 17 00:00:00 2001 From: Omar Hernandez Date: Tue, 18 Feb 2014 18:58:01 -0600 Subject: [PATCH] Register as an AMD Support for Asynchronous Module Definition. --- jquery.titlealert.js | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/jquery.titlealert.js b/jquery.titlealert.js index 69276f6..c313f88 100644 --- a/jquery.titlealert.js +++ b/jquery.titlealert.js @@ -36,7 +36,20 @@ * @example $.titleAlert("Hello World!", {requireBlur:true, stopOnFocus:true, duration:10000, interval:500}); * @desc Flash title bar with text "Hello World!", if the window doesn't have focus, for 10 seconds or until window gets focused, with an interval of 500ms */ -;(function($){ + +//@author Ryan McGeary +(function (factory) { + if (typeof define === 'function' && define.amd) { + + // AMD. Register as an anonymous module. + define(['jquery'], factory); + + } else { + // Browser globals + factory(jQuery); + } + + }(function($){ $.titleAlert = function(text, settings) { // check if it currently flashing something, if so reset it if ($.titleAlert._running) @@ -140,4 +153,4 @@ // bind focus and blur event handlers $(window).bind("focus", $.titleAlert._focus); $(window).bind("blur", $.titleAlert._blur); -})(jQuery); +}));