Build NapCat Artifacts / Windows Loader Test (push) Canceled after 0s
Build NapCat Artifacts / Type Check & Test (push) Canceled after 0s
Build NapCat Artifacts / Build NapCat.Framework (push) Canceled after 0s
Build NapCat Artifacts / Build NapCat.Shell (push) Canceled after 0s
28 lines
477 B
Plaintext
28 lines
477 B
Plaintext
"use client";
|
|
|
|
// src/refs.ts
|
|
import { isFunction } from "@heroui/shared-utils";
|
|
function assignRef(ref, value) {
|
|
if (ref == null)
|
|
return;
|
|
if (isFunction(ref)) {
|
|
ref(value);
|
|
return;
|
|
}
|
|
try {
|
|
ref.current = value;
|
|
} catch (error) {
|
|
throw new Error(`Cannot assign value '${value}' to ref '${ref}'`);
|
|
}
|
|
}
|
|
function mergeRefs(...refs) {
|
|
return (node) => {
|
|
refs.forEach((ref) => assignRef(ref, node));
|
|
};
|
|
}
|
|
|
|
export {
|
|
assignRef,
|
|
mergeRefs
|
|
};
|