Repository: facebook/react
File: packages/react-devtools-fusebox/src/frontend.d.ts (TypeScript)

Code before:
  listen: (fn: WallListener) => Function,
  send: (event: string, payload?: MessagePayload) => void,
};

export type Bridge = {
  addListener(event: string, listener: (params: unknown) => any): void;
  removeListener(event: string, listener: Function): void;
  shutdown: () => void;
};
export type Store = Object;
export type BrowserTheme = 'dark' | 'light';
export type Config = {
  supportsReloadAndProfile?: boolean,
};

export function createBridge(wall: Wall): Bridge;
export function createStore(bridge: Bridge, config?: Config): Store;

export type Source = {
  sourceURL: string,
  line: number,
  column: number,
};
export type ViewElementSource = (
  source: Source,
  symbolicatedSource: Source | null,
) => void;
export type ViewAttributeSource = (
  id: number,
  path: Array<string | number>,
) => void;
export type CanViewElementSource = (
  source: Source,
  symbolicatedSource: Source | null,
) => boolean;

export type InitializationOptions = {
  bridge: Bridge,
  store: Store,
  theme?: BrowserTheme,
  viewAttributeSourceFunction?: ViewAttributeSource,
  viewElementSourceFunction?: ViewElementSource,
  canViewElementSourceFunction?: CanViewElementSource,
};

export function initializeComponents(node: Element | Document, options: InitializationOptions): void;
export function initializeProfiler(node: Element | Document, options: InitializationOptions): void;


Review comment (suggestion):
I don't know if there are any consumers of this in fusebox that needs to be updated. If so, it's probably just the same as the standalone.

https://github.com/facebook/react/pull/33955/files#diff-44b2457a5630ea27596ba5182ef5ec7427b63b6aa2cb4143083eb321e8a12752R153

Code after:
  listen: (fn: WallListener) => Function,
  send: (event: string, payload?: MessagePayload) => void,
};

export type Bridge = {
  addListener(event: string, listener: (params: unknown) => any): void;
  removeListener(event: string, listener: Function): void;
  shutdown: () => void;
};
export type Store = Object;
export type BrowserTheme = 'dark' | 'light';
export type Config = {
  supportsReloadAndProfile?: boolean,
};

export function createBridge(wall: Wall): Bridge;
export function createStore(bridge: Bridge, config?: Config): Store;

export type ReactFunctionLocation = [
  string, // function name
  string, // file name TODO: model nested eval locations as nested arrays
  number, // enclosing line number
  number, // enclosing column number
];
export type ViewElementSource = (
  source: ReactFunctionLocation,
  symbolicatedSource: ReactFunctionLocation | null,
) => void;
export type ViewAttributeSource = (
  id: number,
  path: Array<string | number>,
) => void;
export type CanViewElementSource = (
  source: ReactFunctionLocation,
  symbolicatedSource: ReactFunctionLocation | null,
) => boolean;

export type InitializationOptions = {
  bridge: Bridge,
  store: Store,
  theme?: BrowserTheme,
  viewAttributeSourceFunction?: ViewAttributeSource,
  viewElementSourceFunction?: ViewElementSource,
  canViewElementSourceFunction?: CanViewElementSource,
};

export function initializeComponents(node: Element | Document, options: InitializationOptions): void;
export function initializeProfiler(node: Element | Document, options: InitializationOptions): void;