本文整理汇总了TypeScript中bluebird.attempt函数的典型用法代码示例。如果您正苦于以下问题:TypeScript attempt函数的具体用法?TypeScript attempt怎么用?TypeScript attempt使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了attempt函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: getMissingReferences
private getMissingReferences(): Promise<void> {
return Promise.attempt(() => {
this.missing = Object.create(null);
Lazy(this.removed).keys().each((removed) => {
if (removed in this.refMap) {
this.missing[removed] = this.refMap[removed];
}
});
});
}
示例2: getMaybePromise
return fooThen;
});
// - - - - - - - - - - - - - - - - -
fooProm = Bluebird.try(() => {
if (fooProm) {
return fooProm;
}
return foo;
});
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
fooProm = Bluebird.attempt(() => {
return getMaybePromise();
});
fooProm = Bluebird.attempt<Foo>(() => {
return getMaybePromise();
});
fooProm = Bluebird.attempt(() => {
return foo;
});
// - - - - - - - - - - - - - - - - -
fooProm = Bluebird.attempt(() => {
if (fooProm) {
return fooProm;
}
return foo;