本文整理汇总了TypeScript中@jonggrang/task.sequencePar函数的典型用法代码示例。如果您正苦于以下问题:TypeScript sequencePar函数的具体用法?TypeScript sequencePar怎么用?TypeScript sequencePar使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了sequencePar函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: yield
return T.co(function* () {
const id: string = yield generateSessionId;
const authId: null | string = yield (
auth === HasAuthId.HAS_AUTH_ID ? generateSessionId
: T.pure(null));
const keys: string[] = yield T.sequencePar(replicateArr(20, randomString(8)));
const values: string[] = yield T.sequencePar(replicateArr(20, randomString(16)));
const data = fromPairs(zip(keys, values));
const now = Date.now();
return T.pure(createSession(id, authId, data, now - 1000, now));
});
示例2: shutdownServer
function shutdownServer(
state: ServerState
): T.Task<void> {
return T.sequencePar([
T.liftEff(null, state.connections, destroAllConnections),
closeServer(state.server)
]) as any;
}
示例3: connectAndTrapSignal
function connectAndTrapSignal(
state: ServerState,
settings: Z.Settings
): T.Task<void> {
return T.sequencePar([
T.liftEff(null, state, registerRequestHandler),
listenConnection(state, settings)
]).chain(() => {
return T.race([
waitSignal('SIGINT'),
waitSignal('SIGTERM'),
settings.killToken == null ? T.never : takeAVar(settings.killToken)
]);
});
}
示例4:
export function replicatePar<A>(n: number, t: T.Task<A>): T.Task<A[]> {
return T.sequencePar(arrReplicate(n, t));
}
示例5:
function replicateA<A>(n: number, t: T.Task<A>): T.Task<A[]> {
return T.sequencePar(replicateArr(n, t));
}