Skip to content

Instantly share code, notes, and snippets.

@KennethanCeyer
Created March 4, 2017 22:55
Show Gist options
  • Save KennethanCeyer/19402abf4901a833052319ece54119d4 to your computer and use it in GitHub Desktop.
Save KennethanCeyer/19402abf4901a833052319ece54119d4 to your computer and use it in GitHub Desktop.
Supporting AMD and CommonJS, and Plaintype.
(function(root, factory) {
if(typeof define !== 'undefined' && define.amd) {
// AMD loader type declaration.
define(['jquery', 'moment'], function(jquery, moment) {
factory(window, document, jquery, moment);
});
} else if(typeof module === 'object') {
var jsdom = require('jsdom').jsdom;
var _document = jsdom('<html></html>', {});
var _window = _document.defaultView;
var _jquery = require('jquery')(_window);
var _moment = require('moment');
module.exports = factory(_window, _document, _jquery, _moment);
} else {
root.pignoseCalendar = factory(window, document, jQuery, moment);
}
} (this, function (window, document, jquery, moment) {
// definition of the library.
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment