Skip to content

Commit 3fcb72d

Browse files
committed
Cleaned up unused stuff
1 parent fd8ab30 commit 3fcb72d

21 files changed

Lines changed: 60 additions & 77 deletions

src/api/action.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { invariant, addHiddenProp, OBFUSCATED_ERROR, fail } from "../utils/utils"
1+
import { invariant, addHiddenProp, fail } from "../utils/utils"
22
import { createClassPropertyDecorator } from "../utils/decorators"
33
import { createAction, executeAction, IAction } from "../core/action"
44

@@ -133,7 +133,7 @@ function namedActionDecorator(name: string) {
133133

134134
export function runInAction<T>(block: () => T, scope?: any): T
135135
export function runInAction<T>(name: string, block: () => T, scope?: any): T
136-
export function runInAction<T>(arg1, arg2?, arg3?) {
136+
export function runInAction(arg1, arg2?, arg3?) {
137137
const actionName = typeof arg1 === "string" ? arg1 : arg1.name || "<unnamed action>"
138138
const fn = typeof arg1 === "function" ? arg1 : arg2
139139
const scope = typeof arg1 === "function" ? arg2 : arg3

src/api/autorun.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
import { Lambda, getNextId, invariant, fail, EMPTY_OBJECT, deprecated } from "../utils/utils"
2-
import { isModifierDescriptor } from "../types/modifiers"
1+
import { Lambda, getNextId, invariant, EMPTY_OBJECT, deprecated } from "../utils/utils"
32
import { Reaction, IReactionPublic, IReactionDisposer } from "../core/reaction"
43
import { untrackedStart, untrackedEnd } from "../core/derivation"
5-
import { action, isAction, runInAction } from "./action"
4+
import { action, isAction } from "./action"
65
import { IEqualsComparer, comparer } from "../types/comparer"
76

87
export interface IAutorunOptions {
@@ -110,7 +109,6 @@ export function reaction<T>(
110109
invariant(typeof opts === "object", "Third argument of reactions should be an object")
111110
}
112111
const name = opts.name || "Reaction@" + getNextId()
113-
const fireImmediately = opts.fireImmediately === true
114112
// TODO: creates ugly spy events, use `effect = (r) => runInAction(opts.name, () => effect(r))` instead?
115113
const effectAction = action(name, effect)
116114
const runSync = !opts.scheduler && !opts.delay
@@ -140,8 +138,8 @@ export function reaction<T>(
140138
changed = firstTime || !equals(value, nextValue)
141139
value = nextValue
142140
})
143-
if (firstTime && opts.fireImmediately!) effect(value, r)
144-
if (!firstTime && (changed as boolean) === true) effect(value, r)
141+
if (firstTime && opts.fireImmediately!) effectAction(value, r)
142+
if (!firstTime && (changed as boolean) === true) effectAction(value, r)
145143
if (firstTime) firstTime = false
146144
}
147145

src/api/become-observed.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
import { IObservableArray, IArrayChange, IArraySplice } from "../types/observablearray"
2-
import { ObservableMap, IMapChange } from "../types/observablemap"
3-
import { IObjectChange } from "../types/observableobject"
1+
import { IObservableArray } from "../types/observablearray"
2+
import { ObservableMap } from "../types/observablemap"
43
import { IComputedValue } from "../core/computedvalue"
5-
import { IObservableValue, IValueDidChange } from "../types/observablevalue"
64
import { Lambda } from "../utils/utils"
7-
import { getAdministration, getAtom } from "../types/type-utils"
5+
import { getAtom } from "../types/type-utils"
86
import { IObservable } from "../core/observable"
97
import { fail } from "../utils/utils"
108

src/api/createtransformer.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
import { ComputedValue, IComputedValue } from "../core/computedvalue"
21
import { computed } from "./computed"
32
import { globalState } from "../core/globalstate"
4-
import { comparer } from "../types/comparer"
53
import { invariant, getNextId, addHiddenProp } from "../utils/utils"
64
import { onBecomeUnobserved } from "./become-observed"
75

src/api/decorate.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export function decorate<T>(
88
object: T,
99
decorators: { [P in keyof T]: MethodDecorator | PropertyDecorator }
1010
): T
11-
export function decorate<T>(thing: any, decorators: any) {
11+
export function decorate(thing: any, decorators: any) {
1212
process.env.NODE_ENV !== "production" &&
1313
invariant(isPlainObject(decorators), "Decorators should be a key value map")
1414
const target = typeof thing === "function" ? thing.prototype : thing

src/api/intercept-read.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { fail, Lambda, OBFUSCATED_ERROR } from "../utils/utils"
1+
import { fail, Lambda } from "../utils/utils"
22
import { IObservableArray, isObservableArray } from "../types/observablearray"
33
import { isObservableMap, ObservableMap } from "../types/observablemap"
44
import { isObservableObject } from "../types/observableobject"

src/api/isobservable.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { isObservableObject, ObservableObjectAdministration } from "../types/obs
44
import { isAtom } from "../core/atom"
55
import { isComputedValue } from "../core/computedvalue"
66
import { isReaction } from "../core/reaction"
7-
import { fail, invariant } from "../utils/utils"
7+
import { fail } from "../utils/utils"
88

99
function _isObservable(value, property?: string): boolean {
1010
if (value === null || value === undefined) return false

src/api/object-api.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,11 @@ import { isObservableMap, ObservableMap } from "../types/observablemap"
22
import {
33
isObservableObject,
44
IObservableObject,
5-
ObservableObjectAdministration,
65
IIsObservableObject,
76
defineObservableProperty
87
} from "../types/observableobject"
98
import { isObservableArray, IObservableArray } from "../types/observablearray"
10-
import { fail, invariant, OBFUSCATED_ERROR } from "../utils/utils"
11-
import { extendObservable } from "./extendobservable"
12-
import { isComputedValue } from "../core/computedvalue"
9+
import { fail, invariant } from "../utils/utils"
1310
import { isModifierDescriptor } from "../mobx"
1411
import { deepEnhancer } from "../types/modifiers"
1512
import { startBatch, endBatch } from "../core/observable"

src/api/tojs.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { isObservableArray } from "../types/observablearray"
2-
import { isObservableObject, ObservableObjectAdministration } from "../types/observableobject"
2+
import { isObservableObject } from "../types/observableobject"
33
import { isObservableMap } from "../types/observablemap"
44
import { isObservableValue } from "../types/observablevalue"
55
import { isObservable } from "./isobservable"

src/api/trace.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { globalState } from "../core/globalstate"
22
import { getAtom } from "../types/type-utils"
3-
import { fail, OBFUSCATED_ERROR } from "../utils/utils"
3+
import { fail } from "../utils/utils"
44
import { TraceMode } from "../core/derivation"
55

66
export function trace(thing?: any, prop?: string, enterBreakPoint?: boolean): void

0 commit comments

Comments
 (0)