本文整理汇总了TypeScript中bluebird.each函数的典型用法代码示例。如果您正苦于以下问题:TypeScript each函数的具体用法?TypeScript each怎么用?TypeScript each使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了each函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: function
.then(function() {
return Promise.each(subApps, function(component: Component) {
console.log('Initiating: ' + component.locals.app.get('name'));
if (component.init) {
return component.init();
}
});
})
开发者ID:agneta,项目名称:platform,代码行数:9,代码来源:start.ts
示例2: function
}).then(() => {
if (profile) console.timeEnd(request.path + " scopes");
if (profile) console.time(request.path + " controllers");
return Promise
.each(controllers, function (controller: string) {
if (profile) console.time(request.path + " controller " + controller);
let controllerParts = controller.split(".");
let method = controllerParts.splice(-1)[0];
let id = controllerParts.join(".");
let controllerTypes = Reflect.getMetadata("design:paramtypes", controllerMap[id], method);
return Promise.resolve(controllerMap[id][method].apply(controllerMap[id], Injector.compile(controllerTypes, routeInfo.assembleProviders())))
.then(() => {
if (profile) console.timeEnd(request.path + " controller " + controller)
});
})
})
开发者ID:UnwrittenFun,项目名称:strictly-hapi,代码行数:16,代码来源:bootstrap.ts
示例3: advanceMarketMissingDesignatedReport
async function advanceMarketMissingDesignatedReport(db: Knex, augur: Augur, blockNumber: number, timestamp: number) {
const networkId: string = augur.rpc.getNetworkID();
const universe: string = augur.contracts.addresses[networkId].Universe;
const marketsMissingDesignatedReport = getMarketsWithReportingState(db, ["markets.marketId"])
.where("endTime", "<", timestamp - augur.constants.CONTRACT_INTERVAL.DESIGNATED_REPORTING_DURATION_SECONDS)
.where("reportingState", augur.constants.REPORTING_STATE.DESIGNATED_REPORTING);
const marketAddressRows: Array<MarketsContractAddressRow> = await marketsMissingDesignatedReport;
await each(marketAddressRows, async (marketIdRow) => {
await updateMarketState(db, marketIdRow.marketId, blockNumber, augur.constants.REPORTING_STATE.OPEN_REPORTING);
augurEmitter.emit(SubscriptionEventNames.MarketState, {
universe,
marketId: marketIdRow.marketId,
reportingState: augur.constants.REPORTING_STATE.OPEN_REPORTING,
});
});
}
开发者ID:AugurProject,项目名称:augur_node,代码行数:16,代码来源:process-block.ts
示例4: advanceMarketReachingEndTime
async function advanceMarketReachingEndTime(db: Knex, augur: Augur, blockNumber: number, timestamp: number) {
const networkId: string = augur.rpc.getNetworkID();
const universe: string = augur.contracts.addresses[networkId].Universe;
const designatedDisputeQuery = db("markets")
.select("markets.marketId")
.join("market_state", "market_state.marketStateId", "markets.marketStateId");
designatedDisputeQuery.where("reportingState", augur.constants.REPORTING_STATE.PRE_REPORTING).where("endTime", "<", timestamp);
const designatedDisputeMarketIds: Array<MarketsContractAddressRow> = await designatedDisputeQuery;
await each(designatedDisputeMarketIds, async (marketIdRow) => {
await updateMarketState(db, marketIdRow.marketId, blockNumber, augur.constants.REPORTING_STATE.DESIGNATED_REPORTING);
augurEmitter.emit(SubscriptionEventNames.MarketState, {
universe,
marketId: marketIdRow.marketId,
reportingState: augur.constants.REPORTING_STATE.DESIGNATED_REPORTING,
});
});
}
开发者ID:AugurProject,项目名称:augur_node,代码行数:17,代码来源:process-block.ts
示例5: advanceMarketsToCrowdsourcingDispute
async function advanceMarketsToCrowdsourcingDispute(db: Knex, augur: Augur, blockNumber: number, newActiveFeeWindows: Array<Address>) {
const marketIds: Array<MarketIdUniverseFeeWindow> = await getMarketsWithReportingState(db, ["markets.marketId", "markets.universe", "activeFeeWindow.feeWindow"])
.join("universes", "markets.universe", "universes.universe")
.join("fee_windows as activeFeeWindow", "activeFeeWindow.universe", "markets.universe")
.whereIn("markets.feeWindow", newActiveFeeWindows)
.where("activeFeeWindow.state", FeeWindowState.CURRENT)
.where("reportingState", ReportingState.AWAITING_NEXT_WINDOW)
.where("universes.forked", 0);
await each(marketIds, async (marketIdRow) => {
augurEmitter.emit(SubscriptionEventNames.MarketState, {
universe: marketIdRow.universe,
feeWindow: marketIdRow.feeWindow,
marketId: marketIdRow.marketId,
reportingState: ReportingState.CROWDSOURCING_DISPUTE,
});
return updateMarketState(db, marketIdRow.marketId, blockNumber, ReportingState.CROWDSOURCING_DISPUTE);
});
}
开发者ID:AugurProject,项目名称:augur_node,代码行数:19,代码来源:process-block.ts
示例6: advanceMarketsToAwaitingFinalization
async function advanceMarketsToAwaitingFinalization(db: Knex, augur: Augur, blockNumber: number, expiredFeeWindows: Array<Address>) {
const marketIds: Array<{ marketId: Address; universe: Address }> = await getMarketsWithReportingState(db, ["markets.marketId", "markets.universe"])
.join("universes", "markets.universe", "universes.universe")
.where("universes.forked", 0)
.whereIn("markets.feeWindow", expiredFeeWindows)
.whereNot("markets.needsMigration", 1)
.whereNot("markets.forking", 1);
await each(marketIds, async (marketIdRow) => {
await updateMarketState(db, marketIdRow.marketId, blockNumber, ReportingState.AWAITING_FINALIZATION);
augurEmitter.emit(SubscriptionEventNames.MarketState, {
universe: marketIdRow.universe,
marketId: marketIdRow.marketId,
reportingState: ReportingState.AWAITING_FINALIZATION,
});
return db("payouts")
.where({ marketId: marketIdRow.marketId })
.update("winning", db.raw(`"tentativeWinning"`));
});
}
开发者ID:AugurProject,项目名称:augur_node,代码行数:20,代码来源:process-block.ts
示例7: each
await each(blockNumbers, async (blockNumber: number) => {
const logs = logsByBlock[blockNumber];
if (logs === undefined || logs.length === 0) return;
const dbWritePromises: Array<Promise<(db: Knex) => Promise<void>>> = [];
await each(logs, async (log: FormattedEventLog) => {
const dbWritePromise = processLogByName(augur, log, false);
if (dbWritePromise != null) {
dbWritePromises.push(dbWritePromise);
} else {
logger.info("Log processor does not exist:", JSON.stringify(log));
}
});
const dbWriteFunctions = await Promise.all(dbWritePromises);
await db.transaction(async (trx: Knex.Transaction) => {
await processBlockByBlockDetails(trx, augur, blockDetailsByBlock[blockNumber], true);
await each(logs, async (log) => await insertTransactionHash(trx, blockNumber, log.transactionHash));
logger.info(`Processing ${dbWriteFunctions.length} logs`);
for (const dbWriteFunction of dbWriteFunctions) {
await dbWriteFunction(trx);
}
});
});
开发者ID:AugurProject,项目名称:augur_node,代码行数:22,代码来源:download-augur-logs.ts
示例8:
});
fooArrProm = fooArrProm.filter((item: Foo, index: number, arrayLength: number) => {
return bool;
}, {
concurrency: 1
});
fooArrProm = fooArrProm.filter((item: Foo) => {
return bool;
}, {
concurrency: 1
});
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
fooArrProm = fooArrProm.each((item: Foo): Bar => bar);
fooArrProm = fooArrProm.each((item: Foo, index: number) => index ? bar : null);
fooArrProm = fooArrProm.each((item: Foo, index: number, arrayLength: number): Bar => bar);
fooArrProm = fooArrProm.each((item: Foo, index: number, arrayLength: number): Bluebird<Bar> => barProm);
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
fooProm = new Bluebird.Promise<Foo>((resolve, reject) => {
resolve(foo);
});
fooProm = Bluebird.Promise.try<Foo>(() => {
return foo;
});
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
开发者ID:csrakowski,项目名称:DefinitelyTyped,代码行数:30,代码来源:bluebird-tests.ts
示例9: after
after(() => {
return Bluebird.each(pageIds, pageId => {
return confluency.del(pageId);
});
});
开发者ID:heycalmdown,项目名称:node-confluence,代码行数:5,代码来源:pages.ts
注:本文中的bluebird.each函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论