UNPKG

3.88 kBPlain TextView Raw
1/**
2 * (c) Michel Weststrate 2015 - 2020
3 * MIT Licensed
4 *
5 * Welcome to the mobx sources! To get an global overview of how MobX internally works,
6 * this is a good place to start:
7 * https://medium.com/@mweststrate/becoming-fully-reactive-an-in-depth-explanation-of-mobservable-55995262a254#.xvbh6qd74
8 *
9 * Source folders:
10 * ===============
11 *
12 * - api/ Most of the public static methods exposed by the module can be found here.
13 * - core/ Implementation of the MobX algorithm; atoms, derivations, reactions, dependency trees, optimizations. Cool stuff can be found here.
14 * - types/ All the magic that is need to have observable objects, arrays and values is in this folder. Including the modifiers like `asFlat`.
15 * - utils/ Utility stuff.
16 *
17 */
18import { die } from "./errors"
19import { getGlobal } from "./utils/global"
20;["Symbol", "Map", "Set"].forEach(m => {
21 let g = getGlobal()
22 if (typeof g[m] === "undefined") {
23 die(`MobX requires global '${m}' to be available or polyfilled`)
24 }
25})
26
27import { spy, getDebugName, $mobx } from "./internal"
28
29export {
30 IObservable,
31 IDepTreeNode,
32 Reaction,
33 IReactionPublic,
34 IReactionDisposer,
35 untracked,
36 IAtom,
37 createAtom,
38 spy,
39 IComputedValue,
40 IEqualsComparer,
41 comparer,
42 IEnhancer,
43 IInterceptable,
44 IInterceptor,
45 IListenable,
46 IObjectWillChange,
47 IObjectDidChange,
48 isObservableObject,
49 IValueDidChange,
50 IValueWillChange,
51 IObservableValue,
52 isObservableValue as isBoxedObservable,
53 IObservableArray,
54 IArrayWillChange,
55 IArrayWillSplice,
56 IArraySplice,
57 IArrayUpdate,
58 IArrayDidChange,
59 isObservableArray,
60 IKeyValueMap,
61 ObservableMap,
62 IMapEntries,
63 IMapEntry,
64 IMapWillChange,
65 IMapDidChange,
66 isObservableMap,
67 IObservableMapInitialValues,
68 ObservableSet,
69 isObservableSet,
70 ISetDidChange,
71 ISetWillChange,
72 IObservableSetInitialValues,
73 transaction,
74 observable,
75 IObservableFactory,
76 CreateObservableOptions,
77 computed,
78 IComputedFactory,
79 isObservable,
80 isObservableProp,
81 isComputed,
82 isComputedProp,
83 extendObservable,
84 observe,
85 intercept,
86 autorun,
87 IAutorunOptions,
88 reaction,
89 IReactionOptions,
90 when,
91 IWhenOptions,
92 action,
93 isAction,
94 runInAction,
95 IActionFactory,
96 keys,
97 values,
98 entries,
99 set,
100 remove,
101 has,
102 get,
103 apiOwnKeys as ownKeys,
104 apiDefineProperty as defineProperty,
105 configure,
106 onBecomeObserved,
107 onBecomeUnobserved,
108 flow,
109 isFlow,
110 flowResult,
111 FlowCancellationError,
112 isFlowCancellationError,
113 toJS,
114 trace,
115 IObserverTree,
116 IDependencyTree,
117 getDependencyTree,
118 getObserverTree,
119 resetGlobalState as _resetGlobalState,
120 getGlobalState as _getGlobalState,
121 getDebugName,
122 getAtom,
123 getAdministration as _getAdministration,
124 allowStateChanges as _allowStateChanges,
125 runInAction as _allowStateChangesInsideComputed, // This has become the default behavior in Mobx 6
126 Lambda,
127 $mobx,
128 isComputingDerivation as _isComputingDerivation,
129 onReactionError,
130 interceptReads as _interceptReads,
131 IComputedValueOptions,
132 IActionRunInfo,
133 _startAction,
134 _endAction,
135 allowStateReadsStart as _allowStateReadsStart,
136 allowStateReadsEnd as _allowStateReadsEnd,
137 makeObservable,
138 makeAutoObservable,
139 autoAction as _autoAction,
140 AnnotationsMap,
141 AnnotationMapEntry,
142 override
143} from "./internal"
144
145// Devtools support
146declare const __MOBX_DEVTOOLS_GLOBAL_HOOK__: { injectMobx: (any) => void }
147if (typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__ === "object") {
148 // See: https://github.com/andykog/mobx-devtools/
149 __MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({
150 spy,
151 extras: {
152 getDebugName
153 },
154 $mobx
155 })
156}