當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript typesafe-actions.createAsyncAction函數代碼示例

本文整理匯總了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>();
開發者ID:valtech-nyc,項目名稱:brookjs,代碼行數:8,代碼來源:actions.ts

示例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>()
開發者ID:Carl-Foster,項目名稱:exchange-app,代碼行數:9,代碼來源:depth.ts

示例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>()
開發者ID:Carl-Foster,項目名稱:exchange-app,代碼行數:10,代碼來源:trade.ts

示例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 })
開發者ID:m0g,項目名稱:ansel,代碼行數:31,代碼來源:actions.ts

示例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>();
開發者ID:TheTree,項目名稱:branch,代碼行數:10,代碼來源:actions.ts


注:本文中的typesafe-actions.createAsyncAction函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。