當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。