本文整理汇总了TypeScript中typesafe-actions.createStandardAction函数的典型用法代码示例。如果您正苦于以下问题:TypeScript createStandardAction函数的具体用法?TypeScript createStandardAction怎么用?TypeScript createStandardAction使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了createStandardAction函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: createStandardAction
import { createStandardAction, ActionType } from 'typesafe-actions';
import { Subtitle } from '../../models/subtitle';
const LOAD_DATA = 'jamak/subtitle/LOAD_DATA';
const NEW_DATA = 'jamak/subtitle/NEW_DATA';
const SAVE_DATA = 'jamak/subtitle/SAVE_DATA';
const SET_SELECTION = 'jamak/subtitle/SET_SELECTION';
const APPEND_SELECTION = 'jamak/subtitle/APPEND_SELECTION';
const POP_SELECTION = 'jamak/subtitle/POP_SELECTION';
const ADD_SUBTITLE = 'jamak/subtitle/ADD_SUBTITLE';
const UPDATE_SUBTITLE = 'jamak/subtitle/UPDATE_SUBTITLE';
const DELETE_SUBTITLE = 'jamak/subtitle/DELETE_SUBTITLE';
const SORT_SUBTITLE = 'jamak/subtitle/SORT_SUBTITLE';
export const actions = {
loadData: createStandardAction(LOAD_DATA)<{
filepath: string;
data: Subtitle[];
}>(),
newData: createStandardAction(NEW_DATA)<void>(),
saveData: createStandardAction(SAVE_DATA)<{
filepath: string;
data: Subtitle[];
}>(),
setSelection: createStandardAction(SET_SELECTION)<Set<number>>(),
appendSelection: createStandardAction(APPEND_SELECTION)<Set<number>>(),
popSelection: createStandardAction(POP_SELECTION)<Set<number>>(),
addSubtitle: createStandardAction(ADD_SUBTITLE)<Subtitle>(),
updateSubtitle: createStandardAction(UPDATE_SUBTITLE)<{
index: number;
subtitle: Subtitle;
示例2: createStandardAction
import { DestinyAccount } from './destiny-account.service';
import { createStandardAction } from 'typesafe-actions';
export const accountsLoaded = createStandardAction('accounts/ACCOUNTS_LOADED')<DestinyAccount[]>();
export const setCurrentAccount = createStandardAction('accounts/SET_CURRENT_ACCOUNT')<
DestinyAccount
>();
示例3: createStandardAction
import { createStandardAction, ActionType } from 'typesafe-actions';
const SET_MULTIPLE = 'jamak/timeline/SET_MULTIPLE';
export const actions = {
setMultiple: createStandardAction(SET_MULTIPLE)<number>(),
};
export interface TimelineState {
readonly multiple: number;
}
export type TimelineAction = ActionType<typeof actions>;
const initialState: TimelineState = {
multiple: 1,
};
export default function reducer(
state: TimelineState = initialState,
action: TimelineAction,
): TimelineState {
switch (action.type) {
case SET_MULTIPLE:
return {
...state,
multiple: action.payload,
};
default:
return state;
}
示例4: createStandardAction
import { createStandardAction, ActionType } from 'typesafe-actions';
// Actions
const SET_SUBTITLE_READY = 'jamak/welcome/SUBTITLE_READY';
const SET_VIDEO_READY = 'jamak/welcome/VIDEO_READY';
// Action Creators
export const actions = {
setSubtitleReady: createStandardAction(SET_SUBTITLE_READY)<boolean>(),
setVideoReady: createStandardAction(SET_VIDEO_READY)<boolean>(),
};
export interface WelcomeState {
readonly subtitleReady: boolean;
readonly videoReady: boolean;
}
export type WelcomeAction = ActionType<typeof actions>;
const initialState: WelcomeState = {
subtitleReady: false,
videoReady: false,
};
// Reducers
export default function reducer(
state: WelcomeState = initialState,
action: WelcomeAction,
): WelcomeState {
switch (action.type) {
case SET_SUBTITLE_READY:
示例5: 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>()
示例6: createStandardAction
import { ActionType, createStandardAction } from "typesafe-actions";
import { Tab } from "../components/NavBar";
export const actions = {
setChosenDeckName: createStandardAction("SET_CHOSEN_DECK_NAME")<string>(),
setDecks: createStandardAction("SET_DECKS")<any[]>(),
setDefaultDeckName: createStandardAction("SET_DEFAULT_DECK_NAME")<string>(),
setMoreDeckName: createStandardAction("SET_MORE_DECK_NAME")<string>(),
setShowGoogleImageModal: createStandardAction("SET_SHOW_GOOGLE_IMAGE_MODAL")<boolean>(),
};
export type RootAction = ActionType<typeof actions>;
示例7: createStandardAction
import { createStandardAction } from 'typesafe-actions';
import { InventoryCuratedRoll } from './curatedRollService';
export const updateCurations = createStandardAction('curations/UPDATE')<{
curationEnabled: boolean;
inventoryCuratedRolls: InventoryCuratedRoll[];
}>();