Create setImageFormatsSupported function

This commit is contained in:
Waylon Peng 2021-03-12 23:03:18 -08:00
parent 96ce058d13
commit 54721608a4

View File

@ -2453,6 +2453,20 @@ function OpenSeadragon( options ){
extension = extension ? extension : ""; extension = extension ? extension : "";
// eslint-disable-next-line no-use-before-define // eslint-disable-next-line no-use-before-define
return !!FILEFORMATS[ extension.toLowerCase() ]; return !!FILEFORMATS[ extension.toLowerCase() ];
},
/**
* Updates supported image formats with user-specified values.
* @function
* @example
* // sets webp as supported and png as unsupported
* setImageFormatsSupported({webp: true, png: false});
* @param {Object} formats An object containing format extensions as
* keys and booleans as values.
*/
setImageFormatsSupported: function(formats) {
// eslint-disable-next-line no-use-before-define
Object.assign(FILEFORMATS, formats);
} }
}); });