How to use the extendObservable function from mobx
Find comprehensive JavaScript mobx.extendObservable code examples handpicked from public code repositorys.
27 28 29 30 31 32 33 34 35 36
constructor() { this.contentsDir = join(__dirname, '..', '..', 'static', 'contents') this.items = {} /** Extend the store with observable and computed properties. */ extendObservable(this, { contents: {}, updatedItems: [], updateInProgress: false, updateAgain: false,
1
3
2
+ 12 other calls in file
102 103 104 105 106 107 108 109 110 111
```javascript var m = require('mobx') function Folder(parent, name) { this.parent = parent; m.extendObservable(this, { name: name, children: m.observable.shallow([]), }); }
227
0
21
+ 27 other calls in file
1053 1054 1055 1056 1057 1058 1059 1060 1061 1062
invariant(!_this3.__attributes.includes(currentRel), 'Cannot define `' + currentRel + '` as both an attribute and a relation. You probably need to remove the attribute.'); if (!_this3.__activeCurrentRelations.includes(currentRel)) { _this3.__activeCurrentRelations.push(currentRel); } }); mobx.extendObservable(this, lodash.mapValues(relModels, function (otherRelNames, relName) { var RelModel = relations[relName]; invariant(RelModel, 'Specified relation "' + relName + '" does not exist on model.'); var options = { relations: otherRelNames }; if (RelModel.prototype instanceof Store) {
13
30
11
+ 3 other calls in file
65 66 67 68 69 70 71 72 73 74
return utils_1.baseGet(this.source, parentPath); }; MobxPathObjectBinder.prototype.setValueAsObservable = function (parent, property, value) { var newProps = {}; newProps[property] = value; mobx_1.extendObservable(parent, newProps); }; return MobxPathObjectBinder; }()); Object.defineProperty(exports, "__esModule", { value: true });
0
48
4
+ 35 other calls in file
737 738 739 740 741 742 743 744 745 746
if (!this.__activeCurrentRelations.includes(currentRelation)) { this.__activeCurrentRelations.push(currentRelation); } }); // extendObservable where we omit the fields that are already created from other relations mobx_1.extendObservable(this, lodash_1.mapValues(lodash_1.omit(relationModels, Object.keys(relationModels).filter(rel => !!this[rel])), (otherRelationNames, relationName) => { const RelationModel = relations[relationName]; if (!RelationModel) { throw Error(`Specified relation "${relationName}" does not exist on model.`); }
0
0
0
mobx.runInAction is the most popular function in mobx (1598 examples)