How to use the typesafe-actions.createStandardAction function in typesafe-actions

To help you get started, we’ve selected a few typesafe-actions examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mmazzarolo / chrome-another-tab / src / actions / index.ts View on Github external
"app/TOGGLE_SHOW_HIDDEN_BOOKMARK"
  )(),
  setQuery: createStandardAction("app/SET_QUERY")(),

  // Bookmark actions
  retrieveBookmarks: createStandardAction("bookmark/RETRIEVE_BOOKMARK")(),
  retrieveBookmarksSuccess: createStandardAction(
    "bookmark/RETRIEVE_BOOKMARK_SUCCESS"
  )<{
    foldersById: { [id: string]: ChromeBookmark };
    bookmarksById: { [id: string]: ChromeBookmark };
  }>(),
  hideBookmark: createStandardAction("bookmarks/HIDE_BOOKMARK")(),
  showBookmark: createStandardAction("bookmarks/SHOW_BOOKMARK")(),
  hideFolder: createStandardAction("bookmarks/HIDE_FOLDER")(),
  showFolder: createStandardAction("bookmarks/SHOW_FOLDER")(),

  // Theme actions
  goToNextTheme: createStandardAction("theme/GO_TO_NEXT_THEME")(),

  // Other
  rehydrate: createStandardAction("other/REHYDRATE_REQUEST")(),
  rehydrateSuccess: createStandardAction("other/REHYDRATE_SUCCESS")<
    ReduxPersistedState
  >()
};
github DestinyItemManager / DIM / src / app / inventory / actions.ts View on Github external
export const update = createStandardAction('inventory/UPDATE')<{
  stores: DimStore[];
  buckets?: InventoryBuckets;
  newItems?: Set;
  profileResponse?: DestinyProfileResponse;
}>();

/**
 * Set the bucket info.
 */
export const setBuckets = createStandardAction('inventory/SET_BUCKETS')();

/**
 * Move an item from one store to another.
 */
export const moveItem = createStandardAction('inventory/MOVE_ITEM')<{
  item: DimItem;
  source: DimStore;
  target: DimStore;
  equip: boolean;
  amount: number;
}>();

// TODO: tags/notes should probably be their own part of state
export const setTag = createStandardAction('inventory/SET_TAG')<{
  itemId: string;
  tag: string;
}>();

/** Update the set of new items. */
export const setNewItems = createStandardAction('new_items/SET')>();
github mmazzarolo / just-tap / src / actions / index.ts View on Github external
import { ReduxPersistedState } from "./../types/ReduxPersistedState";
import { createStandardAction } from "typesafe-actions";

export const actions = {
  // Game actions
  startGame: createStandardAction("game/START_GAME")(),
  startNewRound: createStandardAction("game/START_NEW_ROUND")(),
  play: createStandardAction("game/PLAY")(),
  showInterlude: createStandardAction("game/SHOW_INTERLUDE")(),
  endGame: createStandardAction("game/END_GAME")<{ score: number }>(),
  showResult: createStandardAction("game/SHOW_RESULT")(),
  tap: createStandardAction("game/TAP")(),
  timerTick: createStandardAction("game/TIMER_TICK")(),

  // Router actions
  navigateToPlayground: createStandardAction("router/NAVIGATE_TO_PLAYGROUND")(),
  navigateToMenu: createStandardAction("router/NAVIGATE_TO_MENU")(),

  // Other generic actions
  rehydrate: createStandardAction("app/REHYDRATE_REQUEST")(),
  rehydrateSuccess: createStandardAction("app/REHYDRATE_SUCCESS")<
    ReduxPersistedState
  >()
};
github DestinyItemManager / DIM / src / app / inventory / actions.ts View on Github external
import { DestinyProfileResponse } from 'bungie-api-ts/destiny2';

/**
 * Reflect the old stores service data into the Redux store as a migration aid.
 */
export const update = createStandardAction('inventory/UPDATE')<{
  stores: DimStore[];
  buckets?: InventoryBuckets;
  newItems?: Set;
  profileResponse?: DestinyProfileResponse;
}>();

/**
 * Set the bucket info.
 */
export const setBuckets = createStandardAction('inventory/SET_BUCKETS')();

/**
 * Move an item from one store to another.
 */
export const moveItem = createStandardAction('inventory/MOVE_ITEM')<{
  item: DimItem;
  source: DimStore;
  target: DimStore;
  equip: boolean;
  amount: number;
}>();

// TODO: tags/notes should probably be their own part of state
export const setTag = createStandardAction('inventory/SET_TAG')<{
  itemId: string;
  tag: string;
github leejh3224 / react-native-hello-talk / src / store / modules / auth.ts View on Github external
createAsyncAction,
  getType,
  createStandardAction
} from "typesafe-actions";
import * as firebase from "firebase";
import { withPrefix } from "store/utils";
import { eventChannel } from "redux-saga";
import { call, take, put, fork } from "redux-saga/effects";

export const loadUsers = createAsyncAction(
  withPrefix("LOAD_USERS_REQUEST"),
  withPrefix("LOAD_USERS_SUCCESS"),
  withPrefix("LOAD_USERS_FAILURE")
)();

export const updateCurrentUser = createStandardAction(
  withPrefix("UPDATE_CURRENT_USER")
)();

/**
 * state = {
 *   me // currentUser
 *   users // other users -> 50 of them will be stored
 * }
 */
export const reducer = (state = {}, action) => {
  switch (action.type) {
    case getType(updateCurrentUser): {
      return {
        ...state,
        me: action.payload
      };
github kiali / kiali-ui / src / actions / GraphFilterActions.ts View on Github external
// Action Creators allow us to create typesafe utilities for dispatching actions
import { ActionType, createAction, createStandardAction } from 'typesafe-actions';
import { GraphType } from '../types/Graph';
import { EdgeLabelMode } from '../types/GraphFilter';
import { ActionKeys } from './ActionKeys';

export const GraphFilterActions = {
  setEdgelLabelMode: createStandardAction(ActionKeys.GRAPH_FILTER_SET_EDGE_LABEL_MODE)(),
  setFindValue: createStandardAction(ActionKeys.GRAPH_FILTER_SET_FIND_VALUE)(),
  setGraphType: createStandardAction(ActionKeys.GRAPH_FILTER_SET_GRAPH_TYPE)(),
  setHideValue: createStandardAction(ActionKeys.GRAPH_FILTER_SET_HIDE_VALUE)(),
  setShowUnusedNodes: createStandardAction(ActionKeys.GRAPH_FILTER_SET_SHOW_UNUSED_NODES)(),
  // Toggle actions
  showGraphFilters: createStandardAction(ActionKeys.ENABLE_GRAPH_FILTERS)(),
  toggleCompressOnHide: createAction(ActionKeys.GRAPH_FILTER_TOGGLE_COMPRESS_ON_HIDE),
  toggleGraphNodeLabel: createAction(ActionKeys.GRAPH_FILTER_TOGGLE_GRAPH_NODE_LABEL),
  toggleLegend: createAction(ActionKeys.GRAPH_FILTER_TOGGLE_LEGEND),
  toggleGraphVirtualServices: createAction(ActionKeys.GRAPH_FILTER_TOGGLE_GRAPH_VIRTUAL_SERVICES),
  toggleGraphCircuitBreakers: createAction(ActionKeys.GRAPH_FILTER_TOGGLE_GRAPH_CIRCUIT_BREAKERS),
  toggleGraphMissingSidecars: createAction(ActionKeys.GRAPH_FILTER_TOGGLE_GRAPH_MISSING_SIDECARS),
  toggleGraphSecurity: createAction(ActionKeys.GRAPH_FILTER_TOGGLE_GRAPH_SECURITY),
  toggleFindHelp: createAction(ActionKeys.GRAPH_FILTER_TOGGLE_FIND_HELP),
  toggleServiceNodes: createAction(ActionKeys.GRAPH_FILTER_TOGGLE_SERVICE_NODES),
  toggleTrafficAnimation: createAction(ActionKeys.GRAPH_FILTER_TOGGLE_TRAFFIC_ANIMATION),
  toggleUnusedNodes: createAction(ActionKeys.GRAPH_FILTER_TOGGLE_UNUSED_NODES)
};
github bnankiewicz / organic / src / components / editor / actions.ts View on Github external
import { createStandardAction as action, createAsyncAction as asyncAction } from 'typesafe-actions'
import { Perspective, Item, Route } from './types'
import { Dispatch } from 'redux';

// TODO export every action separatelly and then import all
const setEntriesOrdering = action('editor/SET_ENTRIES_ORDERING')()
const setEntriesLevels = action('editor/SET_ENTRIES_LEVELS')()
const addItem = action('editor/ADD_ITEM')()
const deleteItems = action('editor/DELETE_ITEMS')()
const changeItems = action('editor/CHANGE_ITEMS')()

const focusItem = action('editor/FOCUS_ITEM')<{ entryId: string }>()
const repeatLastAction = action('editor/REPEAT_LAST_ACTION')()
const scheduleNextUpdate = action('editor/SCHEDULE_NEXT_UPDATE')()
const addActionToQueue = action('editor/ADD_ACTION_TO_QUEUE')()
const openItem = action('editor/OPEN_ITEM')()
const onIndexChange = action('editor/ON_INDEX_CHANGE')()
const activateNextRoute = action('editor/ACTIVATE_NEXT_ROUTE')()
const onFocusedItemChange = action('editor/ON_FOCUSED_ITEM_CHANGE')<{ route: Route, position: number, item: Item}>()

export default {
  onFocusedItemChange,
  activateNextRoute,
  onIndexChange,
  openItem,
  addActionToQueue,
  scheduleNextUpdate,
  focusItem,
  changeItems,
github sharedstreets / sharedstreets-road-closure-ui / src / store / road-closure / index.ts View on Github external
'ROAD_CLOSURE/FETCH_SHAREDSTREETS_MATCH_POINT_REQUEST',
        'ROAD_CLOSURE/FETCH_SHAREDSTREETS_MATCH_POINT_SUCCESS',
        'ROAD_CLOSURE/FETCH_SHAREDSTREETS_MATCH_POINT_FAILURE'
    )(),
    FETCH_SHAREDSTREETS_MATCH_POINT_CANCEL: createStandardAction('ROAD_CLOSURE/FETCH_SHAREDSTREETS_MATCH_POINT_CANCEL')(),
    FETCH_SHAREDSTREETS_PUBLIC_DATA: createAsyncAction(
        'ROAD_CLOSURE/FETCH_SHAREDSTREETS_PUBLIC_DATA_REQUEST',
        'ROAD_CLOSURE/FETCH_SHAREDSTREETS_PUBLIC_DATA_SUCCESS',
        'ROAD_CLOSURE/FETCH_SHAREDSTREETS_PUBLIC_DATA_FAILURE'
    )(),
    FETCH_SHAREDSTREET_GEOMS: createAsyncAction(
        'ROAD_CLOSURE/FETCH_SHAREDSTREET_GEOMS_REQUEST',
        'ROAD_CLOSURE/FETCH_SHAREDSTREET_GEOMS_SUCCESS',
        'ROAD_CLOSURE/FETCH_SHAREDSTREET_GEOMS_FAILURE'
    )(),
    FILE_ADDED: createStandardAction('ROAD_CLOSURE/FILE_ADDED')(),
    GENERATE_SHAREDSTREETS_PUBLIC_DATA_UPLOAD_URL: createAsyncAction(
        'ROAD_CLOSURE/GENERATE_SHAREDSTREETS_PUBLIC_DATA_UPLOAD_URL_REQUEST',
        'ROAD_CLOSURE/GENERATE_SHAREDSTREETS_PUBLIC_DATA_UPLOAD_URL_SUCCESS',
        'ROAD_CLOSURE/GENERATE_SHAREDSTREETS_PUBLIC_DATA_UPLOAD_URL_FAILURE'
    )(),
    HIGHLIGHT_MATCHED_STREET: createStandardAction('ROAD_CLOSURE/HIGHLIGHT_MATCHED_STREET')(),
    HIGHLIGHT_MATCHED_STREETS_GROUP: createStandardAction('ROAD_CLOSURE/HIGHLIGHT_MATCHED_STREETS_GROUP')(),
    INPUT_CHANGED: createStandardAction('ROAD_CLOSURE/INPUT_CHANGED')(),
    INPUT_REMOVED: createStandardAction('ROAD_CLOSURE/INPUT_REMOVED')(),
    LOAD_ALL_ORGS: createStandardAction('ROAD_CLOSURE/LOAD_ALL_ORGS')<{ [name: string]: IRoadClosureOrgName }>(),
    LOAD_INPUT: createStandardAction('ROAD_CLOSURE/LOAD_INPUT')(),
    PUT_SHAREDSTREETS_PUBLIC_DATA: createAsyncAction(
        'ROAD_CLOSURE/PUT_SHAREDSTREETS_PUBLIC_DATA_REQUEST',
        'ROAD_CLOSURE/PUT_SHAREDSTREETS_PUBLIC_DATA_SUCCESS',
        'ROAD_CLOSURE/PUT_SHAREDSTREETS_PUBLIC_DATA_FAILURE'
    )(),
github drakang4 / jamak / src / renderer / store / modules / player.ts View on Github external
const PAUSE = 'jamak/player/PAUSE';
const STOP = 'jamak/player/STOP';
const MUTE = 'jamak/player/MUTE';
const UNMUTE = 'jamak/player/UNMUTE';
const SET_VOLUME = 'jamak/player/SET_VOLUME';
const SET_SPEED = 'jamak/player/SET_SPEED';
const TIME_UPDATE = 'jamak/player/TIME_UPDATE';
const SEEK = 'jamak/player/SEEK';
const END_SEEK = 'jamak/plyaer/END_SEEK';

export const actions = {
  loadVideo: createStandardAction(LOAD_VIDEO)(),
  loaded: createStandardAction(LOADED)(),
  play: createStandardAction(PLAY)(),
  pause: createStandardAction(PAUSE)(),
  stop: createStandardAction(STOP)(),
  mute: createStandardAction(MUTE)(),
  unmute: createStandardAction(UNMUTE)(),
  setVolume: createStandardAction(SET_VOLUME)(),
  setSpeed: createStandardAction(SET_SPEED)(),
  timeUpdate: createStandardAction(TIME_UPDATE)(),
  seek: createStandardAction(SEEK)(),
  endSeek: createStandardAction(END_SEEK)(),
};

export interface PlayerState {
  readonly loaded: boolean;
  readonly source: string;
  readonly playing: boolean;
  readonly muted: boolean;
  readonly seeking: boolean;
  readonly duration: number;
github drakang4 / jamak / src / renderer / store / modules / player.ts View on Github external
const STOP = 'jamak/player/STOP';
const MUTE = 'jamak/player/MUTE';
const UNMUTE = 'jamak/player/UNMUTE';
const SET_VOLUME = 'jamak/player/SET_VOLUME';
const SET_SPEED = 'jamak/player/SET_SPEED';
const TIME_UPDATE = 'jamak/player/TIME_UPDATE';
const SEEK = 'jamak/player/SEEK';
const END_SEEK = 'jamak/plyaer/END_SEEK';

export const actions = {
  loadVideo: createStandardAction(LOAD_VIDEO)(),
  loaded: createStandardAction(LOADED)(),
  play: createStandardAction(PLAY)(),
  pause: createStandardAction(PAUSE)(),
  stop: createStandardAction(STOP)(),
  mute: createStandardAction(MUTE)(),
  unmute: createStandardAction(UNMUTE)(),
  setVolume: createStandardAction(SET_VOLUME)(),
  setSpeed: createStandardAction(SET_SPEED)(),
  timeUpdate: createStandardAction(TIME_UPDATE)(),
  seek: createStandardAction(SEEK)(),
  endSeek: createStandardAction(END_SEEK)(),
};

export interface PlayerState {
  readonly loaded: boolean;
  readonly source: string;
  readonly playing: boolean;
  readonly muted: boolean;
  readonly seeking: boolean;
  readonly duration: number;
  readonly currentTime: number;