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


TypeScript redux-actions.createAction函數代碼示例

本文整理匯總了TypeScript中redux-actions.createAction函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript createAction函數的具體用法?TypeScript createAction怎麽用?TypeScript createAction使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了createAction函數的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: createNetworkAction

export function createNetworkAction(prefix: string): NetworkAction {
  return {
    start: createAction(`${prefix}_START`),
    error: createAction(`${prefix}_ERROR`),
    complete: createAction(`${prefix}_COMPLETE`),
  }
}
開發者ID:nikteg,項目名稱:loud,代碼行數:7,代碼來源:utils.ts

示例2: function

const actions = function(ajax, todoUrl) {
  return {
    loadTodos: createAction("ACTION_LIST", () => ({promise: ajax.getJSON(todoUrl.get)})),

    editTodo: createAction("ACTION_EDIT"),

    deleteTodo: createAction("ACTION_DELETE",
      todo => ({promise: ajax.deleteJSON(todoUrl.delete(todo.id))}))
  };
};
開發者ID:rrevanth,項目名稱:adventures-reactive-web-dev,代碼行數:10,代碼來源:actions.ts

示例3: return

  return (actionType: string,
          payloadCreator?: (...args: any[]) => Payload,
          metaCreator?: (...args: any[]) => Meta) => {

    const actionCreator = createAction<Payload, Meta>(actionType, payloadCreator, metaCreator);

    return createMultiTypeGetter<typeof actionCreator, StatusTypes>(actionCreator, actionStatusWrappers)(actionType);
  };
開發者ID:morlay,項目名稱:redux-actions,代碼行數:8,代碼來源:buildCreateAction.ts

示例4: Promise

 return new Promise( (resolve, reject) => {
   const notifyRequestingAction = createAction(type, () => { return {}; }, () => { return { pending: true }; });
   dispatch(notifyRequestingAction());
   return promise(args).then( (result) => {
     const actionSuccess = createAction(type);
     dispatch(actionSuccess(result));
     resolve(result);
   }).catch( (error) => {
     const actionError = createAction(type, () => { return error; });
     dispatch(actionError(error));
     reject(error.message);
   });
 });
開發者ID:toannvbk93,項目名稱:goemon,代碼行數:13,代碼來源:redux.ts

示例5: createAction

export function createAction(type: string, payloadCreator, metaCreator) {
  type = `$SOS_${type}`
  const actionCreator = _createAction(type, payloadCreator, metaCreator)
  const creator = (...args) => {
    const action = actionCreator(...args)
    if (typeof action.payload === 'function') {
      return Object.assign(action, {args})
    }
    return action
  }

  return Object.assign(creator, {
    toString: actionCreator.toString,
    payload(payload) {
      return {type, payload}
    },
    reply(args, result) {
      return {type, payload: {args, result}}
    }
  })
}
開發者ID:tianjianchn,項目名稱:medis,代碼行數:21,代碼來源:utils.ts

示例6: createAction

///<reference path="../../../typings/browser.d.ts"/>
/**
 *
 * Created by hanrui on 2016/3/1.
 */
import {createAction, handleAction, handleActions} from 'redux-actions'
import {message} from 'antd'
import {push} from 'react-router-redux'
const UPDATE_UNLEARNED_STUDY = createAction('UPDATE_UNLEARNED_STUDY')
const UPDATE_LEARNED_STUDY = createAction('UPDATE_LEARNED_STUDY')
const get_unlearn_department_study = (): ReduxThunk.ThunkInterface => {
    return (dispatch, state) => {
        const url = '/api/study/get-unlearned-study/'
      fetch(url, {
        credentials: 'include',
      }).then(response => {
            if (response.status == 200) {
                response.json().then(json => dispatch(UPDATE_UNLEARNED_STUDY(json)))
            } else {
                response.json().then(json => {
                    message.error(JSON.parse(json))
                })
            }
        })
    }
}
const SHOW_ADD_STUDY_MODAL = createAction("SHOW_ADD_STUDY_MODAL")
const add_study = (question:string, answer:string = ''):ReduxThunk.ThunkInterface => {
  return (dispatch, state) => {
    const url = '/api/study/professional-study/'
    fetch(url, {
開發者ID:rui19921122,項目名稱:MeetingSystem,代碼行數:31,代碼來源:study.ts

示例7: createAction

import { createAction, handleActions } from 'redux-actions'

export enum ACTION_TYPES {
  TOGGLE_STATUS_SERVICES = '@ReactiveTraderCloud/TOGGLE_STATUS_SERVICES',
  OPEN_LINK = '@ReactiveTraderCloud/FOOTER_OPEN_LINK',
}

export const toggleStatusServices = createAction(ACTION_TYPES.TOGGLE_STATUS_SERVICES)
export const openLinks = createAction(ACTION_TYPES.OPEN_LINK, payload => payload)

const INITIAL_STATE = false


export const footerEpic = openFin => (action$) => {
  return action$.ofType(ACTION_TYPES.OPEN_LINK)
    .map(action => openLinks(openFin))
}

export default handleActions(
  {
    [ACTION_TYPES.TOGGLE_STATUS_SERVICES]: state => !state,
  },
  INITIAL_STATE)
開發者ID:carlosrfernandez,項目名稱:ReactiveTraderCloud,代碼行數:23,代碼來源:FooterOperations.ts

示例8:

 * specific language governing permissions and limitations
 * under the License.
 */

/* eslint-disable @typescript-eslint/no-empty-interface */

import { createAction } from 'redux-actions';
import { KibanaAction } from '../../selectors/types';

export enum MetadataActionTypeKeys {
  UPDATE_DESCRIPTION = 'UPDATE_DESCRIPTION',
  UPDATE_TITLE = 'UPDATE_TITLE',
}

export type UpdateTitleActionPayload = string;

export interface UpdateTitleAction
  extends KibanaAction<MetadataActionTypeKeys.UPDATE_TITLE, UpdateTitleActionPayload> {}

export type UpdateDescriptionActionPayload = string;

export interface UpdateDescriptionAction
  extends KibanaAction<MetadataActionTypeKeys.UPDATE_DESCRIPTION, UpdateDescriptionActionPayload> {}

export type MetadataActions = UpdateDescriptionAction | UpdateTitleAction;

export const updateDescription = createAction<UpdateDescriptionAction>(
  MetadataActionTypeKeys.UPDATE_DESCRIPTION
);
export const updateTitle = createAction<UpdateTitleAction>(MetadataActionTypeKeys.UPDATE_TITLE);
開發者ID:elastic,項目名稱:kibana,代碼行數:30,代碼來源:metadata.ts

示例9:

/*
 * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
 * or more contributor license agreements. Licensed under the Elastic License;
 * you may not use this file except in compliance with the Elastic License.
 */

import { createAction } from 'redux-actions';
import { HotKey } from '../components/shortcuts';

export const registerShortcut = createAction<HotKey>('REGISTER SHORTCUT');
export const unregisterShortcut = createAction<HotKey>('UNREGISTER SHORTCUT');

export const toggleHelp = createAction<boolean | null>('TOGGLE SHORTCUTS HELP');
開發者ID:elastic,項目名稱:kibana,代碼行數:13,代碼來源:shortcuts.ts


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