当前位置: 首页>>代码示例>>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;未经允许,请勿转载。