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

TypeScript typescript-fsa.default函数代码示例

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

本文整理汇总了TypeScript中typescript-fsa.default函数的典型用法代码示例。如果您正苦于以下问题:TypeScript default函数的具体用法?TypeScript default怎么用?TypeScript default使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了default函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。

示例1: actionCreatorFactory

import actionCreatorFactory from "typescript-fsa";
import { reducerWithInitialState } from "typescript-fsa-reducers";

import tabs, { TabId } from "../tabs";

export default interface Sidebar {
  activeTabId: TabId;
  expanded: boolean;
}

export const SAFE_INIT: Sidebar = {
  activeTabId: "lar",
  expanded: true,
};

const actionCreator = actionCreatorFactory("SIDEBAR");

export const activateTab = actionCreator<TabId>("ACTIVATE");
export const collapse = actionCreator("COLLAPSE");
export const expand = actionCreator("EXPAND");

export const reducer = reducerWithInitialState(SAFE_INIT)
  .case(
    activateTab,
    (original: Sidebar, activeTabId: TabId) => ({ ...original, activeTabId }),
  ).case(
    collapse,
    (original: Sidebar) => ({ ...original, expanded: false }),
  ).case(
    expand,
    (original: Sidebar) => ({ ...original, expanded: true }),
开发者ID:cmc333333,项目名称:mapusaurus,代码行数:31,代码来源:Sidebar.ts


示例2: actionCreatorFactory

  longitude: number;
  zoom: number;
}

export default interface Viewport extends StaticViewport {
  transitionDuration: number;
}

export const SAFE_INIT: Viewport = {
  latitude: 41.88,
  longitude: -87.64,
  transitionDuration: 0,
  zoom: 12,
};

const actionCreator = actionCreatorFactory("VIEWPORT");

export const setViewport = actionCreator<StaticViewport>("SET");
export const transitionViewport = actionCreator<StaticViewport>("TRANSITION");

export const reducer = reducerWithInitialState(SAFE_INIT)
  .case(setViewport, (_, { latitude, longitude, zoom }) => ({
    latitude,
    longitude,
    transitionDuration: 0,
    zoom: Math.min(zoom, 12),
  }))
  .case(transitionViewport, (_, { latitude, longitude, zoom }) => ({
    latitude,
    longitude,
    transitionDuration: 3000,
开发者ID:cmc333333,项目名称:mapusaurus,代码行数:31,代码来源:Viewport.ts


示例3: actionCreatorFactory

/*
 * 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 actionCreatorFactory from 'typescript-fsa';

import { FilterQuery } from './reducer';

const actionCreator = actionCreatorFactory('x-pack/infra/local/waffle_filter');

export const setWaffleFilterQueryDraft = actionCreator<FilterQuery>(
  'SET_WAFFLE_FILTER_QUERY_DRAFT'
);

export const applyWaffleFilterQuery = actionCreator<FilterQuery>('APPLY_WAFFLE_FILTER_QUERY');
开发者ID:salihkardan,项目名称:kibana,代码行数:17,代码来源:actions.ts


示例4: actionCreatorFactory

import actionCreatorFactory from 'typescript-fsa';

export const actionCreator = actionCreatorFactory(`@@manager/images`);

export const getImagesRequest = actionCreator(`request`);

export const getImagesSuccess = actionCreator<Linode.Image[]>(`success`);

export const getImagesFailure = actionCreator<Linode.ApiFieldError[]>(`fail`);

export const removeImage = actionCreator<number | string>(`remove`);

export const addOrUpdateImage = actionCreator<Linode.Image>('add_or_update');
开发者ID:displague,项目名称:manager,代码行数:13,代码来源:image.actions.ts


示例5: actionCreatorFactory

import actionCreatorFactory from 'typescript-fsa';

const actionCreator = actionCreatorFactory(`@@manager/types`);

export const getLinodeTypesActions = actionCreator.async<
  void,
  Linode.LinodeType[],
  Linode.ApiFieldError[]
>(`request`);
开发者ID:linode,项目名称:manager,代码行数:9,代码来源:linodeType.actions.ts


示例6: actionCreatorFactory

}
interface AddRemoveFilter {
  county?: GeoId;
  lender?: LenderId;
  metro?: GeoId;
}

export const SAFE_INIT: Filters = {
  ...homePurchasePreset,
  county: Set<GeoId>(),
  lender: Set<LenderId>(),
  metro: Set<GeoId>(),
  year: NaN,
};

const actionCreator = actionCreatorFactory("LAR/FILTERS");
const asyncActionCreator = asyncFactory<Filters>(actionCreator);

export const addFilter = actionCreator<AddRemoveFilter>("ADD_FILTER");
export const removeFilter = actionCreator<AddRemoveFilter>("REMOVE_FILTER");
export const setFilters = actionCreator<Partial<Filters>>("SET_FILTERS");

export const zoomToGeos = asyncActionCreator<void, void>(
  "ZOOM_TO_GEOS",
  (_, dispatch, getState: () => any) => {
    const { lar, window: { height, width } } = getState();
    const { filters, lookups } = lar;
    const geos = filters.county.toArray().map(id => lookups.geos.get(id))
      .concat(filters.metro.toArray().map(id => lookups.geos.get(id)));

    if (geos.length) {
开发者ID:cmc333333,项目名称:mapusaurus,代码行数:31,代码来源:Filters.ts


示例7: actionCreatorFactory

import actionCreatorFactory from 'typescript-fsa';
import { ExtendedEvent } from './event.helpers';

type Event = ExtendedEvent;

export const ADD_EVENTS = `ADD_EVENTS`;

export const UPDATE_EVENTS_AS_SEEN = `UPDATE_EVENTS_AS_SEEN`;

export const actionCreator = actionCreatorFactory(`@@manager/events`);

export const addEvents = actionCreator<Event[]>(ADD_EVENTS);

export const updateEventsAsSeen = actionCreator(UPDATE_EVENTS_AS_SEEN);
开发者ID:linode,项目名称:manager,代码行数:14,代码来源:event.actions.ts


示例8: actionCreatorFactory

/*
 * 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 actionCreatorFactory from 'typescript-fsa';

import { HostsSortField } from '../../graphql/types';
import { KueryFilterQuery, SerializedFilterQuery } from '../model';

import { HostsType } from './model';

const actionCreator = actionCreatorFactory('x-pack/siem/local/hosts');

export const updateAuthenticationsLimit = actionCreator<{ limit: number; hostsType: HostsType }>(
  'UPDATE_AUTHENTICATIONS_LIMIT'
);

export const updateHostsLimit = actionCreator<{ limit: number; hostsType: HostsType }>(
  'UPDATE_HOSTS_LIMIT'
);

export const updateHostsSort = actionCreator<{
  sort: HostsSortField;
  hostsType: HostsType;
}>('UPDATE_HOSTS_SORT');

export const updateEventsLimit = actionCreator<{ limit: number; hostsType: HostsType }>(
  'UPDATE_EVENTS_LIMIT'
);
开发者ID:,项目名称:,代码行数:31,代码来源:


示例9: actionCreatorFactory

import { Dispatch } from 'redux';
import actionCreatorFactory from 'typescript-fsa';
import { asyncFactory } from 'typescript-fsa-redux-thunk';
import { RootState } from './reducer';

const create = actionCreatorFactory();
const createAsync = asyncFactory<RootState>(create as any);

export function promiseAction<Returns, ActionParams = {}, Error = {}>(
  // tslint:disable-next-line:no-any
  name: string, func: (params: ActionParams, dispatch?: Dispatch, getState?: any, extraArg?: any) => Promise<Returns>
) {
  return createAsync<ActionParams, Returns, Error>(name, func);
}
开发者ID:stevejhiggs,项目名称:macgyver,代码行数:14,代码来源:actionCreator.ts


示例10: actionCreatorFactory

/*
 * 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 actionCreatorFactory from 'typescript-fsa';

const actionCreator = actionCreatorFactory('x-pack/infra/local/metric_time');

export interface MetricRangeTimeState {
  to: number;
  from: number;
  interval: string;
}

export const setRangeTime = actionCreator<MetricRangeTimeState>('SET_RANGE_TIME');

export const startMetricsAutoReload = actionCreator('START_METRICS_AUTO_RELOAD');

export const stopMetricsAutoReload = actionCreator('STOP_METRICS_AUTO_RELOAD');
开发者ID:lucabelluccini,项目名称:kibana,代码行数:21,代码来源:actions.ts



注:本文中的typescript-fsa.default函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
TypeScript typescript-fsa.isType函数代码示例发布时间:2022-05-25
下一篇:
TypeScript typescript-fsa.actionCreatorFactory函数代码示例发布时间: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