Make SwaggerUi UMD compatible
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
window.SwaggerUi = Backbone.Router.extend({
|
||||
var SwaggerUi = Backbone.Router.extend({
|
||||
|
||||
dom_id: 'swagger_ui',
|
||||
|
||||
@@ -195,6 +195,7 @@ window.SwaggerUi = Backbone.Router.extend({
|
||||
|
||||
});
|
||||
|
||||
window.SwaggerUi = SwaggerUi;
|
||||
window.SwaggerUi.Views = {};
|
||||
|
||||
// don't break backward compatibility with previous versions and warn users to upgrade their code
|
||||
@@ -228,4 +229,25 @@ window.SwaggerUi.Views = {};
|
||||
console.warn(message);
|
||||
}
|
||||
}
|
||||
})();
|
||||
})();
|
||||
|
||||
|
||||
// UMD
|
||||
(function (root, factory) {
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// AMD. Register as an anonymous module.
|
||||
define(['b'], function (b) {
|
||||
return (root.SwaggerUi = factory(b));
|
||||
});
|
||||
} else if (typeof exports === 'object') {
|
||||
// Node. Does not work with strict CommonJS, but
|
||||
// only CommonJS-like enviroments that support module.exports,
|
||||
// like Node.
|
||||
module.exports = factory(require('b'));
|
||||
} else {
|
||||
// Browser globals
|
||||
root.SwaggerUi = factory(root.b);
|
||||
}
|
||||
}(this, function () {
|
||||
return SwaggerUi;
|
||||
}));
|
||||
Reference in New Issue
Block a user