const ReactDebugCurrentFrame: {
setExtraStackFrame?: (stack: null | string) => void,
getCurrentStack?: null | (() => string),
getStackAddendum?: () => string,
} = {};
let currentExtraStackFrame = (null: null | string);
export function setExtraStackFrame(stack: null | string): void {
if (__DEV__) {
currentExtraStackFrame = stack;
}
}
if (__DEV__) {
ReactDebugCurrentFrame.setExtraStackFrame = function (stack: null | string) {
if (__DEV__) {
currentExtraStackFrame = stack;
}
};
ReactDebugCurrentFrame.getCurrentStack = (null: null | (() => string));
ReactDebugCurrentFrame.getStackAddendum = function (): string {
let stack = '';
if (currentExtraStackFrame) {
stack += currentExtraStackFrame;
}
const impl = ReactDebugCurrentFrame.getCurrentStack;
if (impl) {
stack += impl() || '';
}
return stack;
};
}
export default ReactDebugCurrentFrame;