Permalink
Browse files

Added AMD and CommonJS support following umd/jqueryPluginCommonjs.js …

…wrapper
  • Loading branch information...
1 parent ce83f1f commit a03483bbebab813506a10aa010755e9bf8eb2f8b @fernandogmar fernandogmar committed Aug 14, 2012
Showing with 15 additions and 3 deletions.
  1. +15 −3 jquery.jsperanto.js
View
@@ -1,8 +1,19 @@
//jquery 1.3.2 dependencies : $.each, $.extend, $.ajax
-(function($) {
+// Uses CommonJS, AMD or browser globals to create a jQuery extension.
+(function (factory) {
+ if (typeof exports === 'object') {
+ // Node/CommonJS
+ factory(require('jquery'));
+ } else if (typeof define === 'function' && define.amd) {
+ // AMD. Register as an anonymous module.
+ define(['jquery'], factory);
+ } else {
+ // Browser globals
+ factory(jQuery);
+ }
+}(function($) {
-
var o = {};
var dictionary = false; //not yet loaded
var currentLang = false;
@@ -150,4 +161,5 @@
detectLanguage : detectLanguage,
lang : lang
};
-})(jQuery);
+}));
+

0 comments on commit a03483b

Please sign in to comment.