diff --git a/UPNG.js b/UPNG.js index a1c0106..8a1fb77 100644 --- a/UPNG.js +++ b/UPNG.js @@ -1,5 +1,10 @@ var UPNG = {}; +if (typeof globalThis === 'object') { + globalThis.UPNG = UPNG; +} else if (typeof window === 'object') { + window.UPNG = UPNG; +}; @@ -786,7 +791,7 @@ UPNG.encode._filterZero = function(img,h,bpp,bpl,data, filter, levelZero) else if(h*bpl>500000 || bpp==1) ftry=[0]; var opts; if(levelZero) opts={level:0}; - var CMPR = (levelZero && UZIP!=null) ? UZIP : pako; + var CMPR = (levelZero && typeof UZIP === 'object' && UZIP!=null) ? UZIP : pako; for(var i=0; i