本文整理匯總了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>();