本文整理匯總了TypeScript中mobx.observable.map方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript observable.map方法的具體用法?TypeScript observable.map怎麽用?TypeScript observable.map使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類mobx.observable
的用法示例。
在下文中一共展示了observable.map方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: constructor
constructor(graph: Remath, initialState?: INodeState) {
super(initialState);
this._graph = graph;
this._id = (initialState && initialState.id) || genId();
this._providers = observable.map<INode>();
this._dependents = observable.map<INode>();
}
示例2: it
it('Adding variable whose formula references a non-existent symbol', () => {
const remath = new Remath();
let view: ObservableMap<string> = observable.map<string>();
const render = sinon.spy(() => {
renderCells(remath, view);
});
autorun(render);
// add a
const a = remath.addCell({
symbol: 'a',
formula: '= b + 10'
});
expect(render.callCount).to.equal(2);
expect(view.get('a')).to.equal('sym:a,formula:b + 10,val:NaN,disp:#REF?');
// add b = 30
runInAction(() => {
const b = remath.addCell({
symbol: 'b',
formula: '=30'
});
});
expect(view.get('b')).to.equal('sym:b,formula:30,val:30,disp:30');
expect(view.get('a')).to.equal('sym:a,formula:b + 10,val:40,disp:40');
});
示例3: it
it('throws if an undo instance is called twice', () => {
let object = observable.map({ key: 2 });
let undoableAction = action('updateMap')(() => {
object.set('key', 5);
});
let undoResult = createUndo('updateMap')(undoableAction);
undoResult();
expect(undoResult).toThrow();
});
示例4: __resetGlobalContext
export function __resetGlobalContext() {
global.__satchelGlobalContext = {
schemaVersion: schemaVersion,
rootStore: observable.map({}),
nextActionId: 0,
subscriptions: {},
dispatchWithMiddleware: null,
inMutator: false,
legacyInDispatch: 0,
legacyDispatchWithMiddleware: null,
legacyTestMode: false,
};
}