@wordpress/block-library
Version:
Block library for the WordPress editor.
22 lines (21 loc) • 784 B
JavaScript
;
Object.defineProperties(exports, {
__esModule: { value: true },
[Symbol.toStringTag]: { value: "Module" }
});
// packages/block-library/src/utils/reduced-motion.js
/**
* Whether the user has asked their operating system to reduce motion.
*
* This is the counterpart to the `useReducedMotion` hook in
* `@wordpress/compose`, for block view scripts, which run outside React. It
* reads the preference once; callers that need to react to it changing should
* watch the media query themselves.
*
* @return {boolean} Whether reduced motion is preferred.
*/
function prefersReducedMotion() {
return window.matchMedia?.("(prefers-reduced-motion: reduce)")?.matches === true;
}
exports.prefersReducedMotion = prefersReducedMotion;
//# sourceMappingURL=reduced-motion.cjs.map