本文整理汇总了TypeScript中mobx.ObservableMap.set方法的典型用法代码示例。如果您正苦于以下问题:TypeScript ObservableMap.set方法的具体用法?TypeScript ObservableMap.set怎么用?TypeScript ObservableMap.set使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mobx.ObservableMap
的用法示例。
在下文中一共展示了ObservableMap.set方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: addDependent
@action
addDependent(dependent: INode): void {
if (this.dependsOn(dependent)) {
this.throwCircRefError(`${dependent.id}'s formula references ${this.id}, but ${this.id} depends on ${dependent.id}`);
}
this._dependents.set(dependent.id, dependent);
}
示例2: addProvider
@action
addProvider(provider: INode): void {
if (this.providesFor(provider)) {
this.throwCircRefError(`${this.id}'s formula references ${provider.id}, but ${provider.id} depends on ${this.id}`);
}
this._providers.set(provider.id, provider);
}
示例3: it
it('mobx reacts when a previously not set key is set', () => {
const map: ObservableMap<string> = observable.map<string>();
map.set('b', 'value b');
let view;
const renderA = sinon.spy(() => {
view = map.get('a');
});
autorun(renderA);
expect(view).to.be.undefined;
expect(renderA.callCount).to.equal(1);
map.set('c', 'value c');
expect(renderA.callCount).to.equal(1);
map.set('a', 'value a');
expect(view).to.equal('value a');
expect(renderA.callCount).to.equal(2);
});
示例4: it
it("builds the data for the volcano plot graph with the correct values", ()=>{
const map_genesets_selected_volcano = new ObservableMap<boolean>();
map_genesets_selected_volcano.set("AKT_UP.V1_DN", true);
const graphData = getVolcanoPlotData(genesets, map_genesets_selected_volcano);
assert.deepEqual(
graphData,
[{
x: 0.1986,
y: -(Math.log(genesets[0].representativePvalue)/Math.log(10)),
fill: "tomato"
},
{
x: 0.3945,
y: -(Math.log(genesets[1].representativePvalue)/Math.log(10)),
fill: "3786C2"
}]
);
});
示例5: __addError
@action
__addError(error: IError): void {
this._errors.set(ErrorType[error.type], error);
}
示例6: addCell
@action
addCell(state: CellState): Cell {
const newCell = new Cell(this, state);
this._cells.set(newCell.id, newCell);
return newCell;
}