本文整理汇总了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);
}
示例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']);
});
示例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},
);
});
示例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);
}
示例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);
}
示例6: nextId
export const create = (): VisualizerState => ({
id: nextId(),
_suppress: true,
_calls: Stack<es.Node>()
})