UNPKG

@wordpress/block-library

Version:
18 lines (17 loc) • 587 B
import { getContext, getElement, store } from "@wordpress/interactivity"; import { prefersReducedMotion } from "../utils/reduced-motion.mjs"; // packages/block-library/src/cover/view.js store("core/cover", { state: { get videoSrc() { const { src, reducedMotionSrc } = getContext(); if (reducedMotionSrc && prefersReducedMotion()) return reducedMotionSrc; return src; } }, callbacks: { stopBackgroundVideo() { if (!prefersReducedMotion()) return; const { ref } = getElement(); ref.autoplay = false; ref.pause(); } } }, { lock: true }); //# sourceMappingURL=view.mjs.map