mirror of
https://github.com/facebook/react.git
synced 2026-02-24 20:53:03 +00:00
Need to tighten up this a bit. react-dom isomorphic currently depends on react-reconciler which is mostly DCE but it's pulled in which makes it hard to make other bundling changes. ReactFlightServer can have a hard dependency on the module that imports its internals since even if other internals are aliased it still always needs the server one.
55 lines
1.5 KiB
JavaScript
55 lines
1.5 KiB
JavaScript
/**
|
|
* 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 {EventPriority} from 'react-reconciler/src/ReactEventPriorities';
|
|
import type {HostDispatcher} from './shared/ReactDOMTypes';
|
|
|
|
// This should line up with NoEventPriority from react-reconciler/src/ReactEventPriorities
|
|
// but we can't depend on the react-reconciler from this isomorphic code.
|
|
export const NoEventPriority: EventPriority = (0: any);
|
|
|
|
type ReactDOMInternals = {
|
|
d /* ReactDOMCurrentDispatcher */: HostDispatcher,
|
|
p /* currentUpdatePriority */: EventPriority,
|
|
findDOMNode:
|
|
| null
|
|
| ((
|
|
componentOrElement: React$Component<any, any>,
|
|
) => null | Element | Text),
|
|
};
|
|
|
|
function noop() {}
|
|
|
|
function requestFormReset(element: HTMLFormElement) {
|
|
throw new Error(
|
|
'Invalid form element. requestFormReset must be passed a form that was ' +
|
|
'rendered by React.',
|
|
);
|
|
}
|
|
|
|
const DefaultDispatcher: HostDispatcher = {
|
|
f /* flushSyncWork */: noop,
|
|
r /* requestFormReset */: requestFormReset,
|
|
D /* prefetchDNS */: noop,
|
|
C /* preconnect */: noop,
|
|
L /* preload */: noop,
|
|
m /* preloadModule */: noop,
|
|
X /* preinitScript */: noop,
|
|
S /* preinitStyle */: noop,
|
|
M /* preinitModuleScript */: noop,
|
|
};
|
|
|
|
const Internals: ReactDOMInternals = {
|
|
d /* ReactDOMCurrentDispatcher */: DefaultDispatcher,
|
|
p /* currentUpdatePriority */: NoEventPriority,
|
|
findDOMNode: null,
|
|
};
|
|
|
|
export default Internals;
|