Home / File/ ReactDOMSrcObject.js — react Source File

ReactDOMSrcObject.js — react Source File

Architecture documentation for ReactDOMSrcObject.js, a javascript file in the react codebase. 0 imports, 2 dependents.

File javascript BabelCompiler Validation 2 dependents 1 functions

Entity Profile

Dependency Diagram

graph LR
  07ac38fd_3da1_78a3_abb5_74bfd98836d2["ReactDOMSrcObject.js"]
  1e990658_7cea_75be_1f24_2399bdf9f15b["ReactDOMComponent.js"]
  1e990658_7cea_75be_1f24_2399bdf9f15b --> 07ac38fd_3da1_78a3_abb5_74bfd98836d2
  9c694103_7f39_88d0_6b4d_f9b2ffed5731["ReactFiberConfigDOM.js"]
  9c694103_7f39_88d0_6b4d_f9b2ffed5731 --> 07ac38fd_3da1_78a3_abb5_74bfd98836d2
  style 07ac38fd_3da1_78a3_abb5_74bfd98836d2 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
 */

export function setSrcObject(domElement: Element, tag: string, value: any) {
  // We optimistically create the URL regardless of object type. This lets us
  // support cross-realms and any type that the browser supports like new types.
  const url = URL.createObjectURL((value: any));
  const loadEvent = tag === 'img' ? 'load' : 'loadstart';
  const cleanUp = () => {
    // Once the object has started loading, then it's already collected by the
    // browser and it won't refer to it by the URL anymore so we can now revoke it.
    URL.revokeObjectURL(url);
    domElement.removeEventListener(loadEvent, cleanUp);
    domElement.removeEventListener('error', cleanUp);
  };
  domElement.addEventListener(loadEvent, cleanUp);
  domElement.addEventListener('error', cleanUp);
  domElement.setAttribute('src', url);
}

Domain

Subdomains

Functions

Frequently Asked Questions

What does ReactDOMSrcObject.js do?
ReactDOMSrcObject.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 ReactDOMSrcObject.js?
ReactDOMSrcObject.js defines 1 function(s): setSrcObject.
What files import ReactDOMSrcObject.js?
ReactDOMSrcObject.js is imported by 2 file(s): ReactDOMComponent.js, ReactFiberConfigDOM.js.
Where is ReactDOMSrcObject.js in the architecture?
ReactDOMSrcObject.js is located at packages/react-dom-bindings/src/client/ReactDOMSrcObject.js (domain: BabelCompiler, subdomain: Validation, directory: packages/react-dom-bindings/src/client).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free