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


TypeScript typescript-fsa.actionCreatorFactory函数代码示例

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


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

示例1: actionCreatorFactory

export const createGraphqlOperationActionCreators = <Data, Variables, Error = ApolloError>(
  stateKey: string,
  operationKey: string
): OperationActionCreators<Data, Variables, Error> => {
  const actionCreator = actionCreatorFactory(`x-pack/infra/remote/${stateKey}/${operationKey}`);

  const resolve = actionCreator<Variables>('RESOLVE');
  const resolveEffect = actionCreator.async<Variables, ApolloQueryResult<Data>>('RESOLVE');

  return {
    resolve,
    resolveStarted: resolveEffect.started,
    resolveDone: resolveEffect.done,
    resolveFailed: resolveEffect.failed,
  };
};
开发者ID:salihkardan,项目名称:kibana,代码行数:16,代码来源:remote_graphql_state.ts

示例2: actionCreatorFactory

import { CreateNodeBalancerPayload } from 'src/services/nodebalancers';
import { actionCreatorFactory } from 'typescript-fsa';

const actionCreator = actionCreatorFactory(`@@manager/nodeBalancer`);

export interface BalancerParams {
  nodeBalancerId: number;
}

type Entity = Linode.NodeBalancer;

export const getAllNodeBalancersActions = actionCreator.async<
  void,
  Linode.NodeBalancer[],
  Linode.ApiFieldError[]
>(`get-all`);

export type CreateNodeBalancerParams = CreateNodeBalancerPayload;

export const createNodeBalancersActions = actionCreator.async<
  CreateNodeBalancerParams,
  Entity,
  Linode.ApiFieldError[]
>(`create`);

/** We require the ID in the action, if we just did Partial<NB> that makes id number | undefined */
export type UpdateNodeBalancerParams = BalancerParams & Partial<Entity>;

export const updateNodeBalancersActions = actionCreator.async<
  UpdateNodeBalancerParams,
  Entity,
开发者ID:linode,项目名称:manager,代码行数:31,代码来源:nodeBalancer.actions.ts

示例3: actionCreatorFactory

import { getRegions } from 'src/services/misc';
import { actionCreatorFactory } from 'typescript-fsa';
import { ThunkActionCreator } from '../types';

const actionCreator = actionCreatorFactory(`@@manager/regions`);

export const regionsRequestActions = actionCreator.async<void, Linode.Region[], Linode.ApiFieldError[]>(`request`);

export const requestRegions: ThunkActionCreator<Promise<Linode.Region[]>> = () => (dispatch) => {
  dispatch(regionsRequestActions.started());

  return getRegions()
    .then(({ data }) => {
      dispatch(regionsRequestActions.done({ result: data }));
      return data;
    })
    .catch((error) => {
      dispatch(regionsRequestActions.failed({ error }));
      return error;
    });
}
开发者ID:displague,项目名称:manager,代码行数:21,代码来源:regions.actions.ts

示例4: actionCreatorFactory

import * as R from 'ramda';
import { ThunkAction } from 'redux-thunk';
import { actionCreatorFactory } from 'typescript-fsa';
import { reducerWithInitialState } from 'typescript-fsa-reducers';
import { gainMana, restoreMana } from './Board/Hero/actions';
import { Game, getDeck, State } from '../Game';
import { activeHero, getOpponent, getPlayer, other } from '../Hero';
import initialState from './initialState';
import { drawCard } from './Deck/deckReducer';
import { selectCards } from '../Card';
import { PlayState, Step } from '../enums';

const actionCreator = actionCreatorFactory();

export const finishGame = actionCreator('FINISH_GAME');
export const nextTurn = actionCreator('NEXT_TURN');

const finishGameHandler = R.evolve<State>({
  step: () => Step.FinalGameOver,
});

const nextTurnHandler = R.evolve<State>({
  turn: R.inc,
  activePlayer: other,
});

export const checkForEndGame = (): ThunkAction<void, Game, {}> => (
  dispatch,
  getState
) => {
  const state = getState();
开发者ID:zernie,项目名称:typescript-redux-card-game,代码行数:31,代码来源:gameStateReducer.ts

示例5: actionCreatorFactory

import {
  BucketRequestPayload,
  DeleteBucketRequestPayload
} from 'src/services/objectStorage/buckets';
import { actionCreatorFactory } from 'typescript-fsa';

export const actionCreator = actionCreatorFactory('@@manager/buckets');

export const createBucketActions = actionCreator.async<
  BucketRequestPayload,
  Linode.Bucket,
  Linode.ApiFieldError[]
>(`create`);

export const getAllBucketsActions = actionCreator.async<
  {},
  Linode.Bucket[],
  Linode.ApiFieldError[]
>('get-all');

export const deleteBucketActions = actionCreator.async<
  DeleteBucketRequestPayload,
  {},
  Linode.ApiFieldError[]
>('delete');
开发者ID:linode,项目名称:manager,代码行数:25,代码来源:bucket.actions.ts

示例6: actionCreatorFactory

import { actionCreatorFactory } from "typescript-fsa";
import { ICardSet } from "../../model/cards";
import { SessionMode, SessionSource } from "../../model/session";
import { IIteration, ITeam } from "../../services/teams";

const factory = actionCreatorFactory("create");

export const init = factory<number[] | undefined>("init");
export const reset = factory<void>("reset");

export const setName = factory<string>("setName");
export const setMode = factory<SessionMode>("setMode");

export const setSource = factory<SessionSource>("setSource");
export const setCardSets = factory<ICardSet[]>("setCardSets");
export const setCardSet = factory<string>("setCardSet");
export const setTeams = factory<ITeam[]>("setTeams");
export const setTeam = factory<string>("setTeam");
export const setIterations = factory<IIteration[]>("setIterations");
export const setIteration = factory<string>("setIteration");
export const setQuery = factory<string>("setQuery");

export const create = factory<void>("create");
开发者ID:cschleiden,项目名称:vsts-estimate,代码行数:23,代码来源:createActions.ts

示例7: actionCreatorFactory

import { actionCreatorFactory } from 'typescript-fsa';

const actionCreator = actionCreatorFactory(`@@manager/profile`);

export const getProfileActions = actionCreator.async<
  void,
  Linode.Profile,
  Linode.ApiFieldError[]
>(`request`);

export const handleUpdate = actionCreator<
  Partial<Linode.Profile> | Partial<Linode.User>
>(`update`);
开发者ID:linode,项目名称:manager,代码行数:13,代码来源:profile.actions.ts

示例8: actionCreatorFactory

import { actionCreatorFactory } from "typescript-fsa";
import { ISession } from "../../model/session";
import { IIteration, ITeam } from "../../services/teams";
import { ILookup } from "../../lib/lookup";
import { IQuery } from "../../model/query";

const factory = actionCreatorFactory("sessions");

export const loadSessions = factory<void>("load");

export const deleteSession = factory<string>("delete");

export const populate = factory<{
    sessions: ISession[];
    legacySessions: ISession[];
}>("populate");

export const setIterationLookup = factory<ILookup<IIteration>>(
    "setIterationLookup"
);

export const setTeamLookup = factory<ILookup<ITeam>>("setTeamLookup");

export const setQueryLookup = factory<ILookup<IQuery>>("setQueryLookup");

export const filter = factory<string>("filter");

export const fatalError = factory<string>("error");

export const clearError = factory<void>("clearError");
开发者ID:cschleiden,项目名称:vsts-estimate,代码行数:30,代码来源:sessionsActions.ts

示例9: actionCreatorFactory

import { actionCreatorFactory } from "typescript-fsa";
import { IIdentity } from "./model/identity";

const factory = actionCreatorFactory("init");

export const init = factory<{
    identity: IIdentity;
}>("init");
开发者ID:cschleiden,项目名称:vsts-estimate,代码行数:8,代码来源:initActions.ts

示例10: actionCreatorFactory

import { LinodeDiskCreationData } from 'src/services/linodes';
import { actionCreatorFactory } from 'typescript-fsa';
import { Entity } from './disk.types';

const actionCreator = actionCreatorFactory(`@@manager/linodeDisks`);

type Error = Linode.ApiFieldError[];

interface LinodeIdParam {
  linodeId: number;
}

interface DiskIdParam {
  diskId: number;
}

export type LinodeDiskCreateFields = LinodeDiskCreationData;

export interface LinodeDiskUpdateFields {
  label: string;
}

/** Get Linode Disk (page) */
export type GetLinodeDisksParams = LinodeIdParam;

export type GetLinodeDisksResponse = Promise<Entity[]>;

export type GetLinodeDisksRequest = (
  params: GetLinodeDisksParams
) => GetLinodeDisksResponse;
开发者ID:linode,项目名称:manager,代码行数:30,代码来源:disk.actions.ts


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