@techmely/utils
Version:
Collection of helpful JavaScript / TypeScript utils
22 lines (16 loc) • 549 B
JavaScript
/*!
* @techmely/utils
* Copyright(c) 2021-2024 Techmely <techmely.creation@gmail.com>
* MIT Licensed
*/
// src/matchMedia.ts
function windowMatchMedia() {
return typeof window !== "undefined" ? window.matchMedia || window.msMatchMedia : void 0;
}
// src/isPrefersReducedMotion.ts
function isPrefersReducedMotion() {
const mediaQuery = windowMatchMedia()?.("(prefers-reduced-motion: reduce)");
return typeof window !== "undefined" ? mediaQuery?.matches : false;
}
exports.isPrefersReducedMotion = isPrefersReducedMotion;
;