This commit is contained in:
Seth Trowbridge 2023-02-09 16:47:45 -05:00
parent 0e2946e4e6
commit 817eb09192

View File

@ -57,6 +57,7 @@ export const Menu = (props) => {
/** @type {React.MutableRefObject<null|Toggler>} */ /** @type {React.MutableRefObject<null|Toggler>} */
const refCollapser = React.useRef(null); const refCollapser = React.useRef(null);
console.log("render...");
React.useEffect(() => { React.useEffect(() => {
refElement.current && refElement.current &&
(refCollapser.current = Collapser(refElement.current)); (refCollapser.current = Collapser(refElement.current));
@ -89,6 +90,8 @@ export const Menu = (props) => {
/** @typedef {(inElement:HTMLElement)=>Toggler} Collapse */ /** @typedef {(inElement:HTMLElement)=>Toggler} Collapse */
/** @type Collapse */ /** @type Collapse */
const Collapser = (inElement) => { const Collapser = (inElement) => {
console.log("collapser initialized");
/** @type UserDone */ /** @type UserDone */
let userDone = () => {}; let userDone = () => {};
let userMode = false; let userMode = false;
@ -109,6 +112,8 @@ const Collapser = (inElement) => {
/** @type Toggler */ /** @type Toggler */
const show = (inOpen, inMs, inDone) => { const show = (inOpen, inMs, inDone) => {
console.log("collapser invoked");
cancelAnimationFrame(frameRequest); cancelAnimationFrame(frameRequest);
if ((!inOpen && !inMs) && !inDone) { if ((!inOpen && !inMs) && !inDone) {
inElement.removeEventListener("transitionend", done); inElement.removeEventListener("transitionend", done);