本文整理汇总了TypeScript中typesafe-actions.createAsyncAction函数的典型用法代码示例。如果您正苦于以下问题:TypeScript createAsyncAction函数的具体用法?TypeScript createAsyncAction怎么用?TypeScript createAsyncAction使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了createAsyncAction函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: createAsyncAction
import { createAsyncAction } from 'typesafe-actions';
import webpack from 'webpack';
export const webpackBuild = createAsyncAction(
'WEBPACK_BUILD_STARTED',
'WEBPACK_BUILD_COMPLETED',
'WEBPACK_BUILD_FAILED'
)<void, webpack.Stats, Error>();
示例2: createAsyncAction
import { createAsyncAction } from 'typesafe-actions'
import { Direction } from '../../types/enums'
import { OrderType } from '../../types/interfaces'
export const getDepthAction = createAsyncAction(
'GET_DEPTH_REQUEST',
'GET_DEPTH_SUCCESS',
'GET_DEPTH_FAILURE',
)<Direction, { direction: Direction, orders: OrderType[] }, Error>()
示例3: createStandardAction
import { createAsyncAction, createStandardAction } from 'typesafe-actions'
import { Direction } from '../../types/enums'
import { APIOrder, FormUpdate, OrderMatch, OrderType } from '../../types/interfaces'
export const tradeFormChange = createStandardAction('TRADE_FORM_CHANGE')<FormUpdate<OrderType>>()
export const placeTradeAction = createAsyncAction(
'PLACE_TRADE_REQUEST',
'PLACE_TRADE_SUCCESS',
'PLACE_TRADE_FAILURE',
)<APIOrder, OrderMatch[], Error>()
示例4: createAsyncAction
import { PhotoId, PhotoType, PhotoDetail, PhotoWork, PhotoSection, PhotoSectionId, PhotoFilter } from '../../common/models/Photo'
import { TagType } from '../../common/models/Tag'
import {
SETTINGS_EXISTS_REQUEST, SETTINGS_EXISTS_SUCCESS, SETTINGS_EXISTS_FAILURE, SET_GRID_ROW_HEIGHT,
SET_DETAIL_PHOTO_REQUEST, SET_DETAIL_PHOTO_SUCCESS, SET_DETAIL_PHOTO_FAILURE,
CLOSE_DETAIL, SET_SELECTED_PHOTOS, SET_LIBRARY_INFO_PHOTO_REQUEST, SET_LIBRARY_INFO_PHOTO_SUCCESS, SET_LIBRARY_INFO_PHOTO_FAILURE,FETCH_TOTAL_PHOTO_COUNT, FETCH_SECTIONS_REQUEST, FETCH_SECTIONS_SUCCESS, FETCH_SECTIONS_FAILURE,
FETCH_SECTION_PHOTOS, FORGET_SECTION_PHOTOS,
CHANGE_PHOTOWORK, CHANGE_PHOTOS, EMPTY_TRASH, START_IMPORT, SET_IMPORT_PROGRESS, FETCH_DATES, FETCH_TAGS, SET_PHOTO_TAGS,
INIT_DEVICES, ADD_DEVICE, REMOVE_DEVICE, OPEN_DIFF, CLOSE_DIFF, OPEN_EXPORT, CLOSE_EXPORT, TOGGLE_DIFF
} from './actionTypes'
import { DatesState } from './reducers/data'
import { ImportProgress } from './reducers/import'
export const checkSettingsExistAction = createAsyncAction(SETTINGS_EXISTS_REQUEST, SETTINGS_EXISTS_SUCCESS, SETTINGS_EXISTS_FAILURE)<void, void, Error>()
export const setGridRowHeightAction = (gridRowHeight: number) => action(SET_GRID_ROW_HEIGHT, { gridRowHeight })
export const setDetailPhotoAction = createAsyncAction(SET_DETAIL_PHOTO_REQUEST, SET_DETAIL_PHOTO_SUCCESS, SET_DETAIL_PHOTO_FAILURE)<{ sectionId: PhotoSectionId, photoIndex: number, photoId: string }, { photoDetail: PhotoDetail, photoWork: PhotoWork }, Error>()
export const closeDetailAction = () => action(CLOSE_DETAIL)
export const setSelectedPhotosAction = (sectionId: PhotoSectionId, photoIds: PhotoId[]) => action(SET_SELECTED_PHOTOS, { sectionId, photoIds })
export const setLibraryInfoPhotoAction = createAsyncAction(SET_LIBRARY_INFO_PHOTO_REQUEST, SET_LIBRARY_INFO_PHOTO_SUCCESS, SET_LIBRARY_INFO_PHOTO_FAILURE)<{ sectionId: PhotoSectionId | null, photoId: PhotoId | null }, { photoDetail: PhotoDetail }, Error>()
export const fetchTotalPhotoCountAction = (totalPhotoCount: number) => action(FETCH_TOTAL_PHOTO_COUNT, { totalPhotoCount })
export const fetchSectionsAction = createAsyncAction(FETCH_SECTIONS_REQUEST, FETCH_SECTIONS_SUCCESS, FETCH_SECTIONS_FAILURE)<{ newFilter: PhotoFilter | null }, { sections: PhotoSection[] }, Error>()
export const fetchSectionPhotosAction = (sectionId: PhotoSectionId, photos: PhotoType[]) => action(FETCH_SECTION_PHOTOS, { sectionId, photos })
export const forgetSectionPhotosAction = (sectionIds: { [index: string]: true }) => action(FORGET_SECTION_PHOTOS, { sectionIds })
export const changePhotoWorkAction = (photoId: PhotoId, photoWork: PhotoWork) => action(CHANGE_PHOTOWORK, { photoId, photoWork })
export const changePhotosAction = (photos: PhotoType[], update: Partial<PhotoType>) => action(CHANGE_PHOTOS, { photos, update })
示例5: createAsyncAction
import { createAsyncAction } from 'typesafe-actions';
import { IdentityActionTypes, IdentityPayload } from './types';
import { BranchError } from '../../common/types';
import { XboxLiveIdentity } from '../types';
export const fetchIdentity = createAsyncAction(
IdentityActionTypes.FETCH_IDENTITY,
IdentityActionTypes.FETCHED_IDENTITY_SUCCESS,
IdentityActionTypes.FETCHED_IDENTITY_FAILURE,
)<IdentityPayload, XboxLiveIdentity, BranchError>();