本文整理汇总了TypeScript中bluebird-retry类的典型用法代码示例。如果您正苦于以下问题:TypeScript bluebird-retry类的具体用法?TypeScript bluebird-retry怎么用?TypeScript bluebird-retry使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了bluebird-retry类的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()
]);
});