本文整理汇总了TypeScript中vs/base/common/history.HistoryNavigator.current方法的典型用法代码示例。如果您正苦于以下问题:TypeScript HistoryNavigator.current方法的具体用法?TypeScript HistoryNavigator.current怎么用?TypeScript HistoryNavigator.current使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vs/base/common/history.HistoryNavigator
的用法示例。
在下文中一共展示了HistoryNavigator.current方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: toArray
function toArray(historyNavigator: HistoryNavigator<string>): string[] {
let result = [];
historyNavigator.first();
if (historyNavigator.current()) {
do {
result.push(historyNavigator.current());
} while (historyNavigator.next());
}
return result;
}
示例2: test
test('create sets the position to last', () => {
const testObject = new HistoryNavigator(['1', '2', '3', '4'], 100);
assert.equal(testObject.current(), null);
assert.equal(testObject.next(), null);
assert.equal(testObject.previous(), '4');
});
示例3: test
test('create sets the position to last', function () {
let testObject = new HistoryNavigator(['1', '2', '3', '4'], 3);
assert.equal('4', testObject.current());
assert.equal(null, testObject.next());
assert.equal('3', testObject.previous());
});
示例4: test
test('next on last element returs null and remains on last', () => {
const testObject = new HistoryNavigator(['1', '2', '3', '4'], 3);
testObject.first();
testObject.last();
assert.equal('4', testObject.current());
assert.equal(null, testObject.next());
});