bindToConsole() — react Function Reference
Architecture documentation for the bindToConsole() function in ReactClientConsoleConfigBrowser.js from the react codebase.
Entity Profile
Dependency Diagram
graph TD b7f64d4f_c3cd_a6de_0fed_dcf464fbc2c1["bindToConsole()"] b7a68687_cc0d_f425_62b6_bb4e76d781ce["ReactClientConsoleConfigBrowser.js"] b7f64d4f_c3cd_a6de_0fed_dcf464fbc2c1 -->|defined in| b7a68687_cc0d_f425_62b6_bb4e76d781ce style b7f64d4f_c3cd_a6de_0fed_dcf464fbc2c1 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/react-client/src/ReactClientConsoleConfigBrowser.js lines 26–73
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/ReactClientConsoleConfigBrowser.js.
Where is bindToConsole() defined?
bindToConsole() is defined in packages/react-client/src/ReactClientConsoleConfigBrowser.js at line 26.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free