本文整理匯總了TypeScript中redux-saga/effects.cancelled函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript cancelled函數的具體用法?TypeScript cancelled怎麽用?TypeScript cancelled使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了cancelled函數的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: channelSaga
export function* channelSaga(session: ISession): SagaIterator {
const channel: IChannel = yield call(getChannel, session.id, session.mode);
yield call([channel, channel.start], session.id);
yield put(connected());
try {
yield all([
call(channelListenerSaga, channel),
call(channelSenderSaga, session.id, channel)
]);
} finally {
if (yield cancelled()) {
yield call([channel, channel.end]);
}
}
}
示例2: while
return function*(repoUri: RepositoryUri) {
try {
while (true) {
// Delay at the beginning to allow some time for the server to consume the
// queue task.
yield call(delay, REPO_STATUS_POLLING_FREQ_MS);
const repoStatus = yield call(fetchStatus, repoUri);
const keepPolling = yield handleStatus(repoStatus, repoUri);
if (!keepPolling) {
yield put(pollingStopActionFunction(repoUri));
}
}
} finally {
if (yield cancelled()) {
// Do nothing here now.
}
}
};
示例3: timer
function* timer() {
try {
yield put(actions.setBotFrozenTimeout(5e3))
while (true) {
const { delta }: actions.Tick = yield take(actions.A.Tick)
const {
game: { botFrozenTimeout },
}: State = yield select()
if (botFrozenTimeout === 0) {
break
}
const next = botFrozenTimeout - delta
yield put(actions.setBotFrozenTimeout(next <= 0 ? 0 : next))
}
} finally {
if (yield cancelled()) {
yield put(actions.setBotFrozenTimeout(0))
}
}
}
示例4: animateCurtainAndLoadMap
function* animateCurtainAndLoadMap(stage: StageConfig) {
try {
yield put(actions.updateComingStageName(stage.name))
yield put(actions.updateCurtain('stage-enter-curtain', 0))
yield* Timing.tween(f(30), t => put(actions.updateCurtain('stage-enter-curtain', t)))
// 在幕布完全將舞台遮起來的時候載入地圖
yield Timing.delay(f(20))
yield put(actions.playSound('stage_start'))
yield put(actions.loadStageMap(stage))
yield Timing.delay(f(20))
yield* Timing.tween(f(30), t => put(actions.updateCurtain('stage-enter-curtain', 1 - t)))
// todo 遊戲開始的時候有一個 反色效果
} finally {
if (yield cancelled()) {
// 將幕布隱藏起來
yield put(actions.updateCurtain('stage-enter-curtain', 0))
}
}
}
示例5: testCancelled
function* testCancelled(): SagaIterator {
yield cancelled();
// typings:expect-error
yield cancelled(1);
}