How to use the autorun function from mobx

Find comprehensive JavaScript mobx.autorun code examples handpicked from public code repositorys.

602
603
604
605
606
607
608
609
610
    relations: this.__activeRelations,
    comparator: comparator
});

// Oh gawd MobX is so awesome.
var events = mobx.autorun(function () {
    var models = _this7.filter(filter);
    store.models.replace(models);
    store.sort();
fork icon13
star icon30
watch icon11

+ 3 other calls in file

181
182
183
184
185
186
187
188
189
190
                hobby: ['causality', 'muffins'],
        };
        let xobj = mobx.observable(obj);
        mylist.push(xobj);

        mobx.autorun(function(){
                count += xobj.hobby.length;
        });
}
for( let element of mylist ){
fork icon1
star icon20
watch icon3

+ 13 other calls in file

21
22
23
24
25
26
27
28
29
30
      mobx.set(observable, value)
    }
  } catch (error) { }
}

mobx.autorun(function () {
  var value = isPropObservable ? target[key] : observable
  value = isBoxed ? observable.get() : value

  localStorage[name] = JSON.stringify(mobx.toJS(value))
fork icon0
star icon1
watch icon0

+ 3 other calls in file

332
333
334
335
336
337
338
339
340
341
342
343


test("when creating a promise in a fulfilled state it should not fire twice, #36", (done) => {
    let events = 0
    const obs = utils.fromPromise.resolve(3)


    mobx.autorun(() => {
        obs.state // track state & value
        obs.value
        events++
    })
fork icon119
star icon0
watch icon0

+ 2 other calls in file

33
34
35
36
37
38
39
40
41
42
43
44
45
}


module.exports = ModifiableCodingRelatedSet;


// const qs = new ModifiableCodingRelatedSet(1340, 10);
// autorun(() => {
//   console.log("[autorun]", qs.questions.length);
// });


// qs.resetCode("sq-1");
fork icon0
star icon0
watch icon0

+ 2 other calls in file

3
4
5
6
7
8
9
10
11
12
};
Object.defineProperty(exports, "__esModule", { value: true });
var mobx_1 = require("mobx");
var Message_1 = __importDefault(require("./types/Message"));
var message = new Message_1.default("Foo", { name: "Michel" }, ["Joe", "Sara"]);
var disposer = mobx_1.autorun(function () {
    console.log(message.title);
    mobx_1.trace();
});
message.updateTitle("Bar");
fork icon0
star icon0
watch icon0