Change layoutScaleFactor based on media query

I am setting my layoutScaleFactor with a constant like this:

<script>
  const layout = new rive.Layout({
  	fit: rive.Fit.Layout, // Change to: rive.Fit.Contain, or Cover
  	alignment: rive.Alignment.Center,
    layoutScaleFactor: .65,
	});
  	const r1 = new rive.Rive({
        src: "animation.riv",
        canvas: document.getElementById("animation"),
        autoplay: true,
        stateMachines: "State Machine 1",
        onLoad: () => {
          computeSize();
        },
      });
  	
  
  function computeSize() {
    r1.resizeDrawingSurfaceToCanvas();
  }

 	window.onresize = computeSize;
  window
  .matchMedia(`(resolution: ${window.devicePixelRatio}dppx)`)
  .addEventListener("change", computeSize);
  
</script>

Everything working great. How can I change the layoutScaleFactor when a media query is below a certain pixel dimension (e.g “below 960, make layoutScaleFactor: .4 ”) ?