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


TypeScript Dispatch.default方法代码示例

本文整理汇总了TypeScript中redux.Dispatch.default方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Dispatch.default方法的具体用法?TypeScript Dispatch.default怎么用?TypeScript Dispatch.default使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在redux.Dispatch的用法示例。


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

示例1: async

export const flushTailBuffer = () => async (
  dispatch: Dispatch<SetTableBackwardDataAction | SetTableForwardDataAction>,
  getState: GetState
) => {
  const {
    logs: {
      tableInfiniteData: {
        forward: currentTailBuffer,
        backward: currentBackward,
      },
    },
  } = getState()

  const combinedBackward = combineTableData(currentTailBuffer, currentBackward)

  await dispatch(setTableBackwardData(combinedBackward))
  await dispatch(setTableForwardData(defaultTableData))
}
开发者ID:viccom,项目名称:influxdb,代码行数:18,代码来源:index.ts

示例2: fetch

export const fetchUsers = () => async (
  dispatch: Dispatch<StoreState>,
  getState: () => StoreState
) => {
  if (Object.keys(getState().users._cache).length > 0) return

  dispatch(setLoading(true))

  dispatch(
    cacheUsers(
      await fetch('http://jsonplaceholder.typicode.com/users').then(response =>
        response.json()
      )
    )
  )

  dispatch(setLoading(false))
}
开发者ID:chaucerbao,项目名称:react-redux-template,代码行数:18,代码来源:users.ts

示例3: getDefinitions

 return getDefinitions(component).then(definitions => {
   const filtered = definitions
     .filter(definition => definition.type !== 'LICENSE')
     // do not display this setting on project level
     .filter(
       definition => !component || definition.key !== 'sonar.branch.longLivedBranches.regex'
     );
   dispatch(receiveDefinitions(filtered));
 });
开发者ID:SonarSource,项目名称:sonarqube,代码行数:9,代码来源:actions.ts

示例4: async

export const addCellAsync = (dashboard: Dashboard) => async (
  dispatch: Dispatch<Action>
): Promise<void> => {
  const cell = getNewDashboardCell(dashboard)

  try {
    const createdCell = await addCellAJAX(dashboard.id, cell)
    const updatedDashboard = {
      ...dashboard,
      cells: [...dashboard.cells, createdCell],
    }

    dispatch(loadDashboard(updatedDashboard))
    dispatch(notify(copy.cellAdded()))
  } catch (error) {
    console.error(error)
  }
}
开发者ID:viccom,项目名称:influxdb,代码行数:18,代码来源:index.ts

示例5: next

    const middleware: Middleware = (store: MiddlewareAPI<AppState>) => (next: Dispatch<AppState>) => (action: AppAction) =>
    {
        switch(action.type)
        {
            case "REQUEST_SYSTEM_APPS": fetchSystemApps(store, action as RequestSystemAppsAction); break;
        }

        return next(action);
    };
开发者ID:foxable,项目名称:app-manager,代码行数:9,代码来源:fetchSystemApps.ts

示例6: return

    return (dispatch:Dispatch<CounterAction>, getState: ()=>ICounterState) => {
        const {counter} = getState();

        if(counter % 2 == 0) {
            return;
        }

        dispatch(increment);
    }
开发者ID:ericlink,项目名称:ts-angular-redux-seed,代码行数:9,代码来源:counter.actions.ts

示例7: async

export const prioritizeItems = (items: MainReportItem[]) => async (dispatch: Dispatch<{}>) => {
  dispatch(onPrioritizeRequest());

  try {

    const data = await exampleClient.prioritizeItems(items);

    if (data) {
      dispatch(onPrioritizeSuccess(data));
    }

  } catch (err) {

    dispatch(onPrioritizeFailure(err));
    return false;
  }
  return true;
};
开发者ID:jmptr,项目名称:lost-sloth,代码行数:18,代码来源:example.ts

示例8: async

 return async (dispatch: Dispatch<IAction<ISiteContent[]>>) => {
     try {
         const siteContent: ISiteContent[] = await api.getLists();
         if (typeof messageData !== "undefined") {
             dispatch(setAllSiteContentAndMessage(siteContent, messageData));
         } else {
             dispatch(setAllSiteContent(siteContent));
         }
     } catch (error) {
         // tslint:disable-next-line:no-console
         console.log(error);
         dispatch(setMessageData({
             message: constants.ERROR_MESSAGE_GET_ALL_SITE_CONTENT,
             showMessage: true,
             type: MessageBarType.error
         }));
     }
 };
开发者ID:DariuS231,项目名称:ChromeSPPropertiesAdmin,代码行数:18,代码来源:spSiteContentActions.ts

示例9: async

 saveAccount: (data: UserClient) => async (
   dispatch: Dispatch<UpdateAction>,
   getState: () => StateTree
 ) => {
   const { api } = getState();
   dispatch({
     type: ActionType.UPDATE,
     state: { isFetchingAccount: true },
   });
   dispatch({
     type: ActionType.UPDATE,
     state: {
       account: await api.saveAccount(data),
       isFetchingAccount: false,
     },
   });
   await actions.claimLocalUser(dispatch, getState);
 },
开发者ID:WordToken,项目名称:voice-web,代码行数:18,代码来源:user.ts

示例10: dispatch

 onDrop: (e: DragEvent, clientRect: ClientRect) => {
   e.preventDefault();
   dispatch(
     Actions.addFigure(
       e.dataTransfer.getData("shape"),
       e.clientX - clientRect.left,
       e.clientY - clientRect.top
     )
   );
 },
开发者ID:vlebedeff,项目名称:malevich,代码行数:10,代码来源:canvas.ts


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