Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added UMD support. #350

Open
wants to merge 1 commit into
base: gh-pages
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 34 additions & 2 deletions js/bootstrap-timepicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,39 @@
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
(function($, window, document) {
(function (factory) {
if (typeof define === 'function' && define.amd) {
define('window', function() {
return window;
});

define('document', function() {
return document;
});
// AMD. Register as an anonymous module.
define(['jquery', 'window', 'document'], factory);
} else if (typeof module === 'object' && module.exports) {
// Node/CommonJS
module.exports = function(root, jQuery, window, document) {
if (jQuery === undefined) {
// require('jQuery') returns a factory that requires window to
// build a jQuery instance, we normalize how we use modules
// that require this pattern but the window provided is a noop
// if it's defined (how jquery works)
if (typeof window !== 'undefined') {
jQuery = require('jquery');
} else {
jQuery = require('jquery')(root);
}
}
factory(jQuery, window, document);
return jQuery;
};
} else {
// Browser globals
factory(jQuery, window, document);
}
}(function($, window, document) {
'use strict';

// TIMEPICKER PUBLIC CLASS DEFINITION
Expand Down Expand Up @@ -1174,4 +1206,4 @@
}
);

})(jQuery, window, document);
}));