当前位置: 首页>>代码示例>>TypeScript>>正文


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

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