bindToConsole() — react Function Reference
Architecture documentation for the bindToConsole() function in ReactClientConsoleConfigServer.js from the react codebase.
Entity Profile
Dependency Diagram
graph TD ae2add17_58ef_b275_0112_89ed6ce2c268["bindToConsole()"] fe262147_d134_6790_d05e_892ad6992cde["ReactClientConsoleConfigServer.js"] ae2add17_58ef_b275_0112_89ed6ce2c268 -->|defined in| fe262147_d134_6790_d05e_892ad6992cde style ae2add17_58ef_b275_0112_89ed6ce2c268 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/react-client/src/ReactClientConsoleConfigServer.js lines 27–74
export function bindToConsole(
methodName: string,
args: Array<any>,
badgeName: string,
): () => any {
let offset = 0;
switch (methodName) {
case 'dir':
case 'dirxml':
case 'groupEnd':
case 'table': {
// These methods cannot be colorized because they don't take a formatting string.
// $FlowFixMe
return bind.apply(console[methodName], [console].concat(args)); // eslint-disable-line react-internal/no-production-logging
}
case 'assert': {
// assert takes formatting options as the second argument.
offset = 1;
}
}
const newArgs = args.slice(0);
if (typeof newArgs[offset] === 'string') {
newArgs.splice(
offset,
1,
badgeFormat + ' ' + newArgs[offset],
badgeStyle,
pad + badgeName + pad,
resetStyle,
);
} else {
newArgs.splice(
offset,
0,
badgeFormat,
badgeStyle,
pad + badgeName + pad,
resetStyle,
);
}
// The "this" binding in the "bind";
newArgs.unshift(console);
// $FlowFixMe
return bind.apply(console[methodName], newArgs); // eslint-disable-line react-internal/no-production-logging
}
Domain
Subdomains
Source
Frequently Asked Questions
What does bindToConsole() do?
bindToConsole() is a function in the react codebase, defined in packages/react-client/src/ReactClientConsoleConfigServer.js.
Where is bindToConsole() defined?
bindToConsole() is defined in packages/react-client/src/ReactClientConsoleConfigServer.js at line 27.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free