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