MCPcopy
hub / github.com/mobxjs/mobx / constructor

Method constructor

packages/mobx/src/types/observableset.ts:78–93  ·  view source on GitHub ↗
(
        initialData?: IObservableSetInitialValues<T>,
        enhancer: IEnhancer<T> = deepEnhancer,
        public name_ = __DEV__ ? "ObservableSet@" + getNextId() : "ObservableSet"
    )

Source from the content-addressed store, hash-verified

76 enhancer_: (newV: any, oldV: any | undefined) => any
77
78 constructor(
79 initialData?: IObservableSetInitialValues<T>,
80 enhancer: IEnhancer<T> = deepEnhancer,
81 public name_ = __DEV__ ? "ObservableSet@" + getNextId() : "ObservableSet"
82 ) {
83 if (!isFunction(Set)) {
84 die(22)
85 }
86 this.enhancer_ = (newV, oldV) => enhancer(newV, oldV, name_)
87 initObservable(() => {
88 this.atom_ = createAtom(this.name_)
89 if (initialData) {
90 this.replace(initialData)
91 }
92 })
93 }
94
95 private dehanceValue_<X extends T | undefined>(value: X): X {
96 if (this.dehancer !== undefined) {

Callers

nothing calls this directly

Calls 6

replaceMethod · 0.95
isFunctionFunction · 0.85
dieFunction · 0.85
initObservableFunction · 0.85
createAtomFunction · 0.85
getNextIdFunction · 0.50

Tested by

no test coverage detected