本文整理汇总了TypeScript中bluebird-retry.default方法的典型用法代码示例。如果您正苦于以下问题:TypeScript bluebird-retry.default方法的具体用法?TypeScript bluebird-retry.default怎么用?TypeScript bluebird-retry.default使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类bluebird-retry
的用法示例。
在下文中一共展示了bluebird-retry.default方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: retry
beforeEach(async () => {
setCacheContext();
const fileName = path.basename(targetFile);
sinon.stub(window, 'showInputBox').returns(Promise.resolve(fileName));
const item: QuickPickItem = { label: '/', description: '' };
sinon.stub(window, 'showQuickPick').returns(Promise.resolve(item));
await retry(async () => openDocument(), { max_tries: 4, interval: 500 });
});
示例2: Error
it('closes file editor', async () => {
let activeEditor: TextEditor;
const retryable = async () => {
await sut.execute();
activeEditor = window.activeTextEditor;
if (activeEditor) {
throw new Error();
}
};
await retry(retryable, { max_tries: 4, interval: 500 });
expect(activeEditor).to.not.exist;
});
示例3: beforeEach
beforeEach(() => {
const openDocument = () => {
const uri = Uri.file(editorFile1);
return workspace.openTextDocument(uri)
.then((textDocument) => window.showTextDocument(textDocument));
};
const stubShowInputBox = () => {
sinon.stub(window, 'showInputBox').returns(Promise.resolve(targetFile));
return Promise.resolve();
};
return Promise.all([
retry(() => openDocument(), { max_tries: 4, interval: 500 }),
stubShowInputBox()
]);
});