- Full-featured monitoring dashboard for local web apps - Real-time status tracking with uptime percentages - Visual sparklines for status history - Add/Edit/Delete apps dynamically - Categories and color coding - Auto-refresh every 30 seconds - API endpoints for apps and status management
55 lines
1.5 KiB
JavaScript
55 lines
1.5 KiB
JavaScript
"use strict";
|
|
Object.defineProperty(exports, "__esModule", {
|
|
value: true
|
|
});
|
|
Object.defineProperty(exports, "useMergedRef", {
|
|
enumerable: true,
|
|
get: function() {
|
|
return useMergedRef;
|
|
}
|
|
});
|
|
const _react = require("react");
|
|
function useMergedRef(refA, refB) {
|
|
const cleanupA = (0, _react.useRef)(()=>{});
|
|
const cleanupB = (0, _react.useRef)(()=>{});
|
|
return (0, _react.useMemo)(()=>{
|
|
if (!refA || !refB) {
|
|
return refA || refB;
|
|
}
|
|
return (current)=>{
|
|
if (current === null) {
|
|
cleanupA.current();
|
|
cleanupB.current();
|
|
} else {
|
|
cleanupA.current = applyRef(refA, current);
|
|
cleanupB.current = applyRef(refB, current);
|
|
}
|
|
};
|
|
}, [
|
|
refA,
|
|
refB
|
|
]);
|
|
}
|
|
function applyRef(refA, current) {
|
|
if (typeof refA === 'function') {
|
|
const cleanup = refA(current);
|
|
if (typeof cleanup === 'function') {
|
|
return cleanup;
|
|
} else {
|
|
return ()=>refA(null);
|
|
}
|
|
} else {
|
|
refA.current = current;
|
|
return ()=>{
|
|
refA.current = null;
|
|
};
|
|
}
|
|
}
|
|
|
|
if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
|
|
Object.defineProperty(exports.default, '__esModule', { value: true });
|
|
Object.assign(exports.default, exports);
|
|
module.exports = exports.default;
|
|
}
|
|
|
|
//# sourceMappingURL=use-merged-ref.js.map
|