utils.js — react Source File
Architecture documentation for utils.js, a javascript file in the react codebase. 1 imports, 1 dependents.
Entity Profile
Dependency Diagram
graph LR 8279557a_7bce_460a_8a5c_d1a3e46f96c0["utils.js"] 27444ff2_8253_76db_da6c_4967b0d20cee["renderer.js"] 8279557a_7bce_460a_8a5c_d1a3e46f96c0 --> 27444ff2_8253_76db_da6c_4967b0d20cee 27444ff2_8253_76db_da6c_4967b0d20cee["renderer.js"] 27444ff2_8253_76db_da6c_4967b0d20cee --> 8279557a_7bce_460a_8a5c_d1a3e46f96c0 style 8279557a_7bce_460a_8a5c_d1a3e46f96c0 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/
import type {InternalInstance} from './renderer';
export function decorate(object: Object, attr: string, fn: Function): Function {
const old = object[attr];
// $FlowFixMe[missing-this-annot] webpack config needs to be updated to allow `this` type annotations
object[attr] = function (instance: InternalInstance) {
return fn.call(this, old, arguments);
};
return old;
}
export function decorateMany(
source: Object,
fns: {[attr: string]: Function, ...},
): Object {
const olds: {[string]: $FlowFixMe} = {};
for (const name in fns) {
olds[name] = decorate(source, name, fns[name]);
}
return olds;
}
export function restoreMany(source: Object, olds: Object): void {
for (const name in olds) {
source[name] = olds[name];
}
}
// $FlowFixMe[missing-this-annot] webpack config needs to be updated to allow `this` type annotations
export function forceUpdate(instance: InternalInstance): void {
if (typeof instance.forceUpdate === 'function') {
instance.forceUpdate();
} else if (
instance.updater != null &&
typeof instance.updater.enqueueForceUpdate === 'function'
) {
instance.updater.enqueueForceUpdate(this, () => {}, 'forceUpdate');
}
}
Domain
Subdomains
Dependencies
Source
Frequently Asked Questions
What does utils.js do?
utils.js is a source file in the react codebase, written in javascript. It belongs to the BabelCompiler domain, Validation subdomain.
What functions are defined in utils.js?
utils.js defines 4 function(s): decorate, decorateMany, forceUpdate, restoreMany.
What does utils.js depend on?
utils.js imports 1 module(s): renderer.js.
What files import utils.js?
utils.js is imported by 1 file(s): renderer.js.
Where is utils.js in the architecture?
utils.js is located at packages/react-devtools-shared/src/backend/legacy/utils.js (domain: BabelCompiler, subdomain: Validation, directory: packages/react-devtools-shared/src/backend/legacy).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free