Home / File/ ReactEventPriorities.js — react Source File

ReactEventPriorities.js — react Source File

Architecture documentation for ReactEventPriorities.js, a javascript file in the react codebase. 1 imports, 4 dependents.

File javascript BabelCompiler Validation 1 imports 4 dependents 5 functions

Entity Profile

Dependency Diagram

graph LR
  e317bb22_8bd8_c9e1_6256_a7d1cb4eaee3["ReactEventPriorities.js"]
  768f6d67_77c1_be19_5596_a943eab59e05["ReactFiberLane.js"]
  e317bb22_8bd8_c9e1_6256_a7d1cb4eaee3 --> 768f6d67_77c1_be19_5596_a943eab59e05
  1f955e30_ff03_d9f9_d498_58b7dc7858dc["ReactFiberDevToolsHook.js"]
  1f955e30_ff03_d9f9_d498_58b7dc7858dc --> e317bb22_8bd8_c9e1_6256_a7d1cb4eaee3
  85d2c68c_7609_2c66_22fb_5f02e8a2e8fe["ReactFiberHooks.js"]
  85d2c68c_7609_2c66_22fb_5f02e8a2e8fe --> e317bb22_8bd8_c9e1_6256_a7d1cb4eaee3
  a22f22c8_f97a_86c8_be5a_4b91a6a21eab["ReactFiberRootScheduler.js"]
  a22f22c8_f97a_86c8_be5a_4b91a6a21eab --> e317bb22_8bd8_c9e1_6256_a7d1cb4eaee3
  d73e9290_2d2e_5d3f_97dd_84929f205c77["ReactFiberWorkLoop.js"]
  d73e9290_2d2e_5d3f_97dd_84929f205c77 --> e317bb22_8bd8_c9e1_6256_a7d1cb4eaee3
  style e317bb22_8bd8_c9e1_6256_a7d1cb4eaee3 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 {Lane, Lanes} from './ReactFiberLane';

import {
  NoLane,
  SyncLane,
  InputContinuousLane,
  DefaultLane,
  IdleLane,
  getHighestPriorityLane,
  includesNonIdleWork,
} from './ReactFiberLane';

export opaque type EventPriority = Lane;

export const NoEventPriority: EventPriority = NoLane;
export const DiscreteEventPriority: EventPriority = SyncLane;
export const ContinuousEventPriority: EventPriority = InputContinuousLane;
export const DefaultEventPriority: EventPriority = DefaultLane;
export const IdleEventPriority: EventPriority = IdleLane;

export function higherEventPriority(
  a: EventPriority,
  b: EventPriority,
): EventPriority {
  return a !== 0 && a < b ? a : b;
}

export function lowerEventPriority(
  a: EventPriority,
  b: EventPriority,
): EventPriority {
  return a === 0 || a > b ? a : b;
}

export function isHigherEventPriority(
  a: EventPriority,
  b: EventPriority,
): boolean {
  return a !== 0 && a < b;
}

export function eventPriorityToLane(updatePriority: EventPriority): Lane {
  return updatePriority;
}

export function lanesToEventPriority(lanes: Lanes): EventPriority {
  const lane = getHighestPriorityLane(lanes);
  if (!isHigherEventPriority(DiscreteEventPriority, lane)) {
    return DiscreteEventPriority;
  }
  if (!isHigherEventPriority(ContinuousEventPriority, lane)) {
    return ContinuousEventPriority;
  }
  if (includesNonIdleWork(lane)) {
    return DefaultEventPriority;
  }
  return IdleEventPriority;
}

Domain

Subdomains

Dependencies

Frequently Asked Questions

What does ReactEventPriorities.js do?
ReactEventPriorities.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 ReactEventPriorities.js?
ReactEventPriorities.js defines 5 function(s): eventPriorityToLane, higherEventPriority, isHigherEventPriority, lanesToEventPriority, lowerEventPriority.
What does ReactEventPriorities.js depend on?
ReactEventPriorities.js imports 1 module(s): ReactFiberLane.js.
What files import ReactEventPriorities.js?
ReactEventPriorities.js is imported by 4 file(s): ReactFiberDevToolsHook.js, ReactFiberHooks.js, ReactFiberRootScheduler.js, ReactFiberWorkLoop.js.
Where is ReactEventPriorities.js in the architecture?
ReactEventPriorities.js is located at packages/react-reconciler/src/ReactEventPriorities.js (domain: BabelCompiler, subdomain: Validation, directory: packages/react-reconciler/src).

Analyze Your Own Codebase

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

Try Supermodel Free