本文整理匯總了TypeScript中mobx.ObservableMap.get方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript ObservableMap.get方法的具體用法?TypeScript ObservableMap.get怎麽用?TypeScript ObservableMap.get使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類mobx.ObservableMap
的用法示例。
在下文中一共展示了ObservableMap.get方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: it
it('reacts to changing values', () => {
const remath = new Remath();
let view: ObservableMap<string> = observable.map<string>();
autorun(() => {
renderCells(remath, view);
});
// add a
runInAction(() => {
const a = remath.addCell({
symbol: 'a',
formula: '= 10'
});
});
expect(view.get('a')).to.equal('sym:a,formula:10,val:10,disp:10');
// add b
runInAction(() => {
const b = remath.addCell({
symbol: 'b',
formula: '= a + 10'
});
});
expect(view.get('a')).to.equal('sym:a,formula:10,val:10,disp:10');
expect(view.get('b')).to.equal('sym:b,formula:a + 10,val:20,disp:20');
// change a
runInAction(() => {
remath.find('a').setFormula('= 20');
});
expect(view.get('a')).to.equal('sym:a,formula:20,val:20,disp:20');
expect(view.get('b')).to.equal('sym:b,formula:a + 10,val:30,disp:30');
});
示例2: find
find(symbolOrId: string): Cell {
let cell: Cell;
const probablyAnId = matchesIdFormat(symbolOrId);
if (probablyAnId) {
cell = this._cells.get(symbolOrId);
}
if (cell === undefined) { // maybe it is a symbol
const hash = hasher.getHash(symbolOrId);
cell = this._cells.get(hash) || null;
}
return cell;
}
示例3:
const renderA = sinon.spy(() => {
view = map.get('a');
});