當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript Immutable.Stack函數代碼示例

本文整理匯總了TypeScript中Immutable.Stack函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript Stack函數的具體用法?TypeScript Stack怎麽用?TypeScript Stack使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了Stack函數的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: createWithContent

    /**
     * 通過內容初始化BaseState
     * @param contentState 內容對象:ContentState.create(contentState: IContentState)
     */
    static createWithContent(contentState: ContentState): BaseState {
        const baseState: IBase = {
            currentContent: contentState,
            tempContentState: contentState,
            redoStack: Stack(),
            undoStack: Stack()
        };

        return BaseState.create(baseState);
    }
開發者ID:xprst,項目名稱:xprst-com,代碼行數:14,代碼來源:BaseState.ts

示例2: it

 it('accepts a keyed Seq', () => {
   var seq = Seq({a:null, b:null, c:null}).flip();
   var s = Stack(seq);
   expect(s.toArray()).toEqual([[null,'a'], [null,'b'], [null,'c']]);
   // Explicit values
   var s2 = Stack(seq.valueSeq());
   expect(s2.toArray()).toEqual(['a', 'b', 'c']);
   // toStack() does this for you.
   var s3 = seq.toStack();
   expect(s3.toArray()).toEqual(['a', 'b', 'c']);
 });
開發者ID:Harishs84,項目名稱:immutable-js,代碼行數:11,代碼來源:Stack.ts

示例3: it

 it('supports React elements {min: true}', () => {
   const reactElement = React.createElement('Mouse', null, 'Hello World');
   expect(Immutable.Stack([reactElement, reactElement])).toPrettyPrintTo(
     'Immutable.Stack [<Mouse>Hello World</Mouse>, <Mouse>Hello World</Mouse>]',
     {min: true},
   );
 });
開發者ID:Volune,項目名稱:jest,代碼行數:7,代碼來源:Immutable.test.ts

示例4: arrayOfSize

    [gen.posInt, gen.posInt], (size1: Number, size2: Number) => {
      var a1 = arrayOfSize(size1);
      var a2 = arrayOfSize(size2);

      var s1 = Stack(a1);
      var s3 = s1.unshift.apply(s1, a2);

      var a3 = a1.slice();
      a3.unshift.apply(a3, a2);

      expect(s3.size).toEqual(a3.length);
      expect(s3.toArray()).toEqual(a3);
    }
開發者ID:Harishs84,項目名稱:immutable-js,代碼行數:13,代碼來源:Stack.ts

示例5: Stack

    [gen.posInt], len => {
      var a = [];
      var s = Stack();

      for (var ii = 0; ii < len; ii++) {
        expect(s.size).toBe(a.length);
        expect(s.toArray()).toEqual(a);
        s = s.unshift(ii);
        a.unshift(ii);
      }
      expect(s.size).toBe(a.length);
      expect(s.toArray()).toEqual(a);
    }
開發者ID:Harishs84,項目名稱:immutable-js,代碼行數:13,代碼來源:Stack.ts

示例6: nextId

export const create = (): VisualizerState => ({
  id: nextId(),
  _suppress: true,
  _calls: Stack<es.Node>()
})
開發者ID:evansb,項目名稱:source-toolchain,代碼行數:5,代碼來源:visualizer.ts


注:本文中的Immutable.Stack函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。