当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript mobx.ObservableMap类代码示例

本文整理汇总了TypeScript中mobx.ObservableMap的典型用法代码示例。如果您正苦于以下问题:TypeScript ObservableMap类的具体用法?TypeScript ObservableMap怎么用?TypeScript ObservableMap使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了ObservableMap类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: 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');
    });
开发者ID:trevorhanus,项目名称:reMath,代码行数:26,代码来源:Integration_1.test.ts

示例2: 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"
         }]
     );
 });
开发者ID:agarwalrounak,项目名称:cbioportal-frontend,代码行数:18,代码来源:GenesetsSelectorStore.spec.ts

示例3: 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;
 }
开发者ID:trevorhanus,项目名称:reMath,代码行数:12,代码来源:Remath.ts

示例4: 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);
 }
开发者ID:trevorhanus,项目名称:reMath,代码行数:7,代码来源:Node.ts

示例5: 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);
 }
开发者ID:trevorhanus,项目名称:reMath,代码行数:7,代码来源:Node.ts

示例6: removeCell

   @action
   removeCell(symbolOrId: string): Cell {
      const cell = this.find(symbolOrId);
      if (!cell) return;

      // remove reference to this node in all dependent nodes
      cell.dependents.forEach(node => {
         node.removeProvider(cell);
      });

      // delete node from graph
      this._cells.delete(cell.id);
      return cell;
   }
开发者ID:trevorhanus,项目名称:reMath,代码行数:14,代码来源:Remath.ts

示例7: errors

 @computed
 get errors(): IError[] {
     return this._errors.values();
 }
开发者ID:trevorhanus,项目名称:reMath,代码行数:4,代码来源:ErrorContainer.ts

示例8:

 @action
 __addError(error: IError): void {
     this._errors.set(ErrorType[error.type], error);
 }
开发者ID:trevorhanus,项目名称:reMath,代码行数:4,代码来源:ErrorContainer.ts


注:本文中的mobx.ObservableMap类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。