本文整理匯總了TypeScript中Immutable.Stack.of方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript Stack.of方法的具體用法?TypeScript Stack.of怎麽用?TypeScript Stack.of使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Immutable.Stack
的用法示例。
在下文中一共展示了Stack.of方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: it
it('push inserts at lowest index', () => {
var s0 = Stack.of('a', 'b', 'c');
var s1 = s0.push('d', 'e', 'f');
expect(s0.size).toBe(3);
expect(s1.size).toBe(6);
expect(s1.toArray()).toEqual(['d', 'e', 'f', 'a', 'b', 'c']);
});
示例2: InterpreterState
export const createInterpreter = (): InterpreterState => {
const globalEnv: Scope = {
name: '_global_',
parent: undefined,
environment: Map<string, any>()
}
return new InterpreterState({
_done: false,
_isReturned: false,
_result: undefined,
isRunning: true,
frames: Stack.of(0),
scopes: Map.of(0, globalEnv),
errors: List(),
value: undefined,
node: undefined
})
}
示例3: constructor
constructor(init: T, private _onChange?: (e: T) => void)
{
this._history = Immutable.Stack.of<T>(init);
this._redoHistory = Immutable.Stack<T>();
}