@wix/design-system
Version:
@wix/design-system
40 lines • 1.27 kB
JavaScript
export function registerWindowMatchMedia() {
if (window && !window.matchMedia) {
window.matchMedia = function () {
return {
matches: false,
media: '',
onchange: null,
addListener() { },
removeListener() { },
addEventListener() { },
removeEventListener() { },
dispatchEvent() {
return false;
},
};
};
}
global.matchMedia = global.matchMedia || window.matchMedia;
}
export function registerIntersectionObserver() {
if (typeof global !== 'undefined' && !global.IntersectionObserver) {
global.IntersectionObserver = class IntersectionObserver {
constructor() { }
observe() { }
unobserve() { }
disconnect() { }
};
}
}
export function registerResizeObserver() {
if (typeof global !== 'undefined' && !global.ResizeObserver) {
global.ResizeObserver = class ResizeObserver {
observe() { }
unobserve() { }
disconnect() { }
};
}
}
export const isTestEnv = process.env.NODE_ENV === 'test';
//# sourceMappingURL=match-media-register.js.map