1 | import "./utils/assertEnvironment"
|
2 |
|
3 | import { unstable_batchedUpdates as batch } from "./utils/reactBatchedUpdates"
|
4 | import { observerBatching } from "./utils/observerBatching"
|
5 | import { useDeprecated } from "./utils/utils"
|
6 | import { useObserver as useObserverOriginal } from "./useObserver"
|
7 | import { enableStaticRendering } from "./staticRendering"
|
8 | import { observerFinalizationRegistry } from "./utils/observerFinalizationRegistry"
|
9 |
|
10 | observerBatching(batch)
|
11 |
|
12 | export { isUsingStaticRendering, enableStaticRendering } from "./staticRendering"
|
13 | export { observer, IObserverOptions } from "./observer"
|
14 | export { Observer } from "./ObserverComponent"
|
15 | export { useLocalObservable } from "./useLocalObservable"
|
16 | export { useLocalStore } from "./useLocalStore"
|
17 | export { useAsObservableSource } from "./useAsObservableSource"
|
18 |
|
19 | export { observerFinalizationRegistry as _observerFinalizationRegistry }
|
20 | export const clearTimers = observerFinalizationRegistry["finalizeAllImmediately"] ?? (() => {})
|
21 |
|
22 | export function useObserver<T>(fn: () => T, baseComponentName: string = "observed"): T {
|
23 | if ("production" !== process.env.NODE_ENV) {
|
24 | useDeprecated(
|
25 | "[mobx-react-lite] 'useObserver(fn)' is deprecated. Use `<Observer>{fn}</Observer>` instead, or wrap the entire component in `observer`."
|
26 | )
|
27 | }
|
28 | return useObserverOriginal(fn, baseComponentName)
|
29 | }
|
30 |
|
31 | export { isObserverBatched, observerBatching } from "./utils/observerBatching"
|
32 |
|
33 | export function useStaticRendering(enable: boolean) {
|
34 | if ("production" !== process.env.NODE_ENV) {
|
35 | console.warn(
|
36 | "[mobx-react-lite] 'useStaticRendering' is deprecated, use 'enableStaticRendering' instead"
|
37 | )
|
38 | }
|
39 | enableStaticRendering(enable)
|
40 | }
|
41 |
|
\ | No newline at end of file |