From 54721608a41c249a93a5ccae210c1147b1087ab1 Mon Sep 17 00:00:00 2001 From: Waylon Peng Date: Fri, 12 Mar 2021 23:03:18 -0800 Subject: [PATCH] Create setImageFormatsSupported function --- src/openseadragon.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/openseadragon.js b/src/openseadragon.js index f61e0133..e638c750 100644 --- a/src/openseadragon.js +++ b/src/openseadragon.js @@ -2453,6 +2453,20 @@ function OpenSeadragon( options ){ extension = extension ? extension : ""; // eslint-disable-next-line no-use-before-define 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); } });