mirror of
https://github.com/openseadragon/openseadragon.git
synced 2024-11-21 20:56:09 +03:00
Merge pull request #984 from aindlq/common-js
Add support for commonjs.
This commit is contained in:
commit
0b8aca750f
@ -10,6 +10,7 @@
|
||||
|
||||
"globals": {
|
||||
"OpenSeadragon": true,
|
||||
"define": false
|
||||
"define": false,
|
||||
"module": false
|
||||
}
|
||||
}
|
||||
|
@ -685,19 +685,10 @@
|
||||
* @param {OpenSeadragon.Options} options - Viewer options.
|
||||
* @returns {OpenSeadragon.Viewer}
|
||||
*/
|
||||
window.OpenSeadragon = window.OpenSeadragon || function( options ){
|
||||
|
||||
function OpenSeadragon( options ){
|
||||
return new OpenSeadragon.Viewer( options );
|
||||
|
||||
};
|
||||
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
define(function () {
|
||||
return (window.OpenSeadragon);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
(function( $ ){
|
||||
|
||||
|
||||
@ -2596,3 +2587,20 @@ if (typeof define === 'function' && define.amd) {
|
||||
}
|
||||
|
||||
}(OpenSeadragon));
|
||||
|
||||
|
||||
// Universal Module Definition, supports CommonJS, AMD and simple script tag
|
||||
(function (root, factory) {
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// expose as amd module
|
||||
define([], factory);
|
||||
} else if (typeof module === 'object' && module.exports) {
|
||||
// expose as commonjs module
|
||||
module.exports = factory();
|
||||
} else {
|
||||
// expose as window.OpenSeadragon
|
||||
root.OpenSeadragon = factory();
|
||||
}
|
||||
}(this, function () {
|
||||
return OpenSeadragon;
|
||||
}));
|
||||
|
Loading…
Reference in New Issue
Block a user