From 3b3eb37dcead2c45a2f73002a6bb14f2f4ef8e30 Mon Sep 17 00:00:00 2001 From: Tomas Kirda Date: Tue, 15 Jan 2013 11:05:09 -0600 Subject: [PATCH] Expose plugin as an AMD module if AMD loader is present --- src/jquery.autocomplete.js | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/src/jquery.autocomplete.js b/src/jquery.autocomplete.js index 7d56f00..b768542 100644 --- a/src/jquery.autocomplete.js +++ b/src/jquery.autocomplete.js @@ -1,17 +1,27 @@ /** -* Ajax Autocomplete for jQuery, version 1.2 -* (c) 2012 Tomas Kirda +* Ajax Autocomplete for jQuery, version 1.2.1 +* (c) 2013 Tomas Kirda * * Ajax Autocomplete for jQuery is freely distributable under the terms of an MIT-style license. * For details, see the web site: http://www.devbridge.com/projects/autocomplete/jquery/ * -* Last Review: 12/22/2012 +* Last Review: 01/15/2013 */ /*jslint browser: true, white: true, plusplus: true, vars: true */ -/*global window: true, document: true, clearInterval: true, setInterval: true, jQuery: true */ +/*global define, window, document, jQuery */ -(function ($) { +// Expose plugin as an AMD module if AMD loader is present: +(function (factory) { + 'use strict'; + if (typeof define === 'function' && define.amd) { + // AMD. Register as an anonymous module. + define(['jquery'], factory); + } else { + // Browser globals + factory(jQuery); + } +}(function ($) { 'use strict'; var utils = (function () { @@ -572,5 +582,4 @@ } }); }; - -}(jQuery)); +}));