Skip to content

Commit

Permalink
Merge pull request #12 from jjoos/master
Browse files Browse the repository at this point in the history
Add CommonJs & AMD compatability
  • Loading branch information
amasad committed Oct 29, 2015
2 parents 52e12d2 + 05003f0 commit 25ea9f0
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
5 changes: 4 additions & 1 deletion .jshintrc
Expand Up @@ -13,5 +13,8 @@
, "unused": true
, "predef": {
"jQuery": false
}
,"define": false
,"module": false
,"require": false
}
}
17 changes: 14 additions & 3 deletions textarea-helper.js
@@ -1,6 +1,17 @@
(function ($) {
(function (factory) {
'use strict';
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define(['jquery'], factory);
} else if (typeof module === 'object' && module.exports) {
// Node/CommonJS
module.exports = factory(require('jquery'));
} else {
// Browser globals
factory(jQuery);
}
}(function ($) {
'use strict';

var caretClass = 'textarea-helper-caret'
, dataKey = 'textarea-helper'

Expand Down Expand Up @@ -118,4 +129,4 @@
}
};

})(jQuery);
}));

0 comments on commit 25ea9f0

Please sign in to comment.