当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript redux-saga.delay函数代码示例

本文整理汇总了TypeScript中redux-saga.delay函数的典型用法代码示例。如果您正苦于以下问题:TypeScript delay函数的具体用法?TypeScript delay怎么用?TypeScript delay使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了delay函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: testDelay

function testDelay() {
  delay(1).then(res => {
    // typings:expect-error
    const e: string = res;
    const r: boolean = res;
  });

  delay(1, 'foo').then(res => {
    // typings:expect-error
    const e: boolean = res;
    const r: string = res;
  });
}
开发者ID:gajus,项目名称:redux-saga,代码行数:13,代码来源:delay.ts

示例2: takeLatest

    yield takeLatest(LoginSuccessType, function* (action: any) {
        if (syncStart || !action.value.result.sync) {
            return;
        }
        syncStart = true;

        yield delay(5000);
        while (true) {
            yield delay(action.value.result.syncInterval * 1000);
            if (GlobalVar.instance.isUserInfoSyncing) {
                continue;
            }
            if (DateUtil.subNowSec(GlobalVar.instance.lastSyncDate) > 5) {
                GlobalVar.instance.isUserInfoSyncing = true;
                const channelAction = syncAction({ type: SyncUserDataType, method: HttpMethod.GET, url: Urls.getUrl(`user/me`), successAction: value => { GlobalVar.instance.isUserInfoSyncing = false; return actionCreator(DateUtil.subNowSec(GlobalVar.instance.lastSyncDate) > 5 ? SyncUserDataSuccessType : EmptyType, { result: value }); } });
                yield put(channelAction);
            }
        }
    });
开发者ID:winken168,项目名称:Hitchhiker,代码行数:19,代码来源:user.ts

示例3: takeLatest

 yield takeLatest(StoreLocalDataType, function* (action: any) {
     try {
         yield delay(1000);
         const state = action.value.state;
         yield call(LocalStore.setState, action.value.userId, { ...state, uiState: { ...state.uiState, syncState: { syncCount: 0, syncItems: [] } } });
     } catch (err) {
         console.log(action.value.state);
         console.error(err);
     }
 });
开发者ID:winken168,项目名称:Hitchhiker,代码行数:10,代码来源:local_data.ts

示例4: function

                return async function() {
                    const tester = expectSaga(queryManagerSaga)
                        .dispatch(refresh(explicitResolveQuery));

                    const testFinished = tester.run();
                    await delay(0);

                    // Query is now in progress, waiting on explicit resolve to
                    // complete. Dispatch two autoRefresh requests, which should
                    // still be serviced.
                    tester
                        .dispatch(autoRefresh(explicitResolveQuery))
                        .dispatch(autoRefresh(explicitResolveQuery));

                    // resolve the query, which should result in the query
                    // immediately being called again due to the auto-refresh
                    // count.
                    await delay(0);
                    resolveQuery();

                    // Dispatch stopAutoRefresh and resolve the query. This
                    // should still result in the query being called again,
                    // because autoRefresh has not been fully decremented.
                    tester
                        .dispatch(stopAutoRefresh(explicitResolveQuery));
                    await delay(0);
                    resolveQuery();

                    // Fully decrement stopAutoRefresh and resolve the query.
                    // Query should not be called again.
                    tester
                        .dispatch(stopAutoRefresh(explicitResolveQuery));
                    await delay(0);
                    resolveQuery();
                    await testFinished;

                    assert.equal(queryCalledCount, 3);
                }();
开发者ID:asubiotto,项目名称:cockroach,代码行数:38,代码来源:saga.spec.ts

示例5: pollingSaga

function* pollingSaga(action: Action<string>) {
  while (true) {
    try {
      const data = yield call(requestStructure, `git:/${action.payload}`);
      yield put(loadStructureSuccess({ path: action.payload!, data }));
    } catch (e) {
      if (e.code && e.code === ServerNotInitialized) {
        yield put(languageServerInitializing());
        yield delay(STRUCTURE_TREE_POLLING_INTERVAL_SEC * 1000);
      } else {
        yield put(loadStructureFailed(e));
      }
    }
  }
}
开发者ID:elastic,项目名称:kibana,代码行数:15,代码来源:structure.ts


注:本文中的redux-saga.delay函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。