Skip to content

programmatic video rendering framework that is actually fast

1.2 KB
Raw Blame
// Generated by ReScript, PLEASE EDIT WITH CARE

import * as Curry from "rescript/lib/es6/curry.js";
import * as React from "react";
import * as Webapi__Dom__Window from "bs-webapi/src/Webapi/Dom/Webapi__Dom__Window.bs.js";
import * as Webapi__Dom__EventTarget from "bs-webapi/src/Webapi/Dom/Webapi__Dom__EventTarget.bs.js";

var DocumentEvent = Webapi__Dom__EventTarget.Impl({});

function getDimensions(param) {
  return {
          width: window.innerWidth,
          height: window.innerHeight
        };
}

function useDimensions(param) {
  var match = React.useState(function () {
        return getDimensions(undefined);
      });
  var setDimensions = match[1];
  React.useLayoutEffect((function () {
          var handleResize = function (param) {
            return Curry._1(setDimensions, getDimensions);
          };
          window.addEventListener("resize", handleResize);
          return (function (param) {
                    window.removeEventListener("resize", handleResize);
                    
                  });
        }), []);
  return match[0];
}

export {
  DocumentEvent ,
  getDimensions ,
  useDimensions ,
  
}
/* DocumentEvent Not a pure module */