本文整理匯總了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));
}