本文整理匯總了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());
});