• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript redux-actions.createAction函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了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;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript redux-actions.handleActions函数代码示例发布时间:2022-05-25
下一篇:
TypeScript redux-actions.combineActions函数代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap