| [ Index ] |
PHP Cross Reference of WordPress Trunk (Updated Daily) |
[Summary view] [Print] [Text view]
1 // packages/block-library/build-module/cover/view.mjs 2 import { getContext, getElement, store } from "@wordpress/interactivity"; 3 4 // packages/block-library/build-module/utils/reduced-motion.mjs 5 function prefersReducedMotion() { 6 return window.matchMedia?.("(prefers-reduced-motion: reduce)")?.matches === true; 7 } 8 9 // packages/block-library/build-module/cover/view.mjs 10 store( 11 "core/cover", 12 { 13 state: { 14 get videoSrc() { 15 const { src, reducedMotionSrc } = getContext(); 16 if (reducedMotionSrc && prefersReducedMotion()) { 17 return reducedMotionSrc; 18 } 19 return src; 20 } 21 }, 22 callbacks: { 23 stopBackgroundVideo() { 24 if (!prefersReducedMotion()) { 25 return; 26 } 27 const { ref } = getElement(); 28 ref.autoplay = false; 29 ref.pause(); 30 } 31 } 32 }, 33 { lock: true } 34 );
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated : Mon Nov 9 08:20:01 2026 | Cross-referenced by PHPXref |