Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Adding support for CommonJS and AMD registration.

Allows for registration as a CommonJS module or registration with an AMD, such as RequireJS.

Falls back to the browser global jQuery object.
  • Loading branch information...
commit 4aef042371a548cab578492f663b873180cdc94e 1 parent d0d4402
@Zoramite Zoramite authored
Showing with 13 additions and 2 deletions.
  1. +13 −2 expanding.js
View
15 expanding.js
@@ -1,4 +1,15 @@
-(function ($) {
+(function(factory) {
+ if (typeof exports === 'object') {
+ // Node/CommonJS
+ factory(require('jquery'));
+ } else if (typeof define === 'function' && define.amd) {
+ // AMD Registration
+ define('expandingTextarea', [ 'jquery' ], factory);
+ } else {
+ // Browser globals
+ factory(jQuery);
+ }
+}(function ($) {
$.expandingTextarea = $.extend({
autoInitialize: true,
initialSelector: "textarea.expanding"
@@ -94,4 +105,4 @@
}
});
-})(jQuery);
+}));
Please sign in to comment.
Something went wrong with that request. Please try again.