當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript effects.cancelled函數代碼示例

本文整理匯總了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]);
        }
    }
}
開發者ID:cschleiden,項目名稱:vsts-estimate,代碼行數:17,代碼來源:channelSaga.ts

示例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.
      }
    }
  };
開發者ID:elastic,項目名稱:kibana,代碼行數:19,代碼來源:project_status.ts

示例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))
    }
  }
}
開發者ID:socoolxin,項目名稱:battle-city,代碼行數:20,代碼來源:powerUpManager.ts

示例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))
    }
  }
}
開發者ID:socoolxin,項目名稱:battle-city,代碼行數:22,代碼來源:stageSaga.ts

示例5: testCancelled

function* testCancelled(): SagaIterator {
  yield cancelled();
  // typings:expect-error
  yield cancelled(1);
}
開發者ID:javarouka,項目名稱:redux-saga,代碼行數:5,代碼來源:effects.ts


注:本文中的redux-saga/effects.cancelled函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。