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


TypeScript typed-immutable-record.makeTypedFactory函数代码示例

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


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

示例1: fromConfig

export function fromConfig(configSet: IFeatureToggleConfigSet) {
  let justTheValues = {};
  for (let prop in configSet) {
    justTheValues[prop] = configSet[prop].setting;
  }
  return makeTypedFactory<IToggle, IToggleRecord>(justTheValues)();
}
开发者ID:kokokenada,项目名称:common-app,代码行数:7,代码来源:feature-toggle-initial-state.ts

示例2: fromJS

import { makeTypedFactory } from 'typed-immutable-record';
import { fromJS } from 'immutable';

import {
  IProfileRecord,
  IProfile,
} from './profile.types';

export const ProfileFactory = makeTypedFactory<IProfile, IProfileRecord>({
  user: fromJS({
    isPending: false,
    isSuccess: false,
    isError: false,
    errorCode: 0,
    item: {},
  }),

  updateUser: fromJS({
    isPending: false,
    isSuccess: false,
    isError: false,
    errorCode: 0,
  }),
});

export const INITIAL_STATE = ProfileFactory();
开发者ID:rtbm,项目名称:ng2-quottr,代码行数:26,代码来源:profile.initial-state.ts

示例3: function

  IObjection,
  IObjectionRecord,
  IRebuttal,
  IRebuttalRecord
} from './list.types';
import { makeTypedFactory } from 'typed-immutable-record';
import { Map, Record, List } from 'immutable';

export const RebuttalFactory = makeTypedFactory<IRebuttal, IRebuttalRecord>({
  id: null,
  shortName: '',
  longName: '',
  link: '',
  comments: '',
  editing: false,
  original: null,
  isTouched: function() {
    return this.original && (this.original.shortName !== this.shortName ||
      this.original.longName !== this.longName ||
      this.original.link !== this.link ||
      (this.original.comments || '') !== (this.comments || ''));
  }
});

export const NewRebuttalFactory = makeTypedFactory<IRebuttal, IRebuttalRecord>({
  id: null,
  shortName: '',
  longName: '',
  link: '',
  comments: '',
  editing: true,
开发者ID:dancancro,项目名称:rangle-started,代码行数:31,代码来源:list.initial-state.ts

示例4: gamePlayReducer

  GamePlayAction, GamePlayActionType, VisibilityType,
  GamePlayActionInterface
} from './action.class';
import {DealLocation, DealSequence, GameConfig} from './game-config.class';
import {Card} from'./card.class';
import {Hand} from './hand.class';
import {Deck} from './deck.class';
import {IPayloadAction} from 'redux-package';
import {GamePlayFunctions} from "./game-play.functions";
import {IGamePlayState} from './game-play-state';

export const GamePlayFactory = makeTypedFactory<IGamePlayState, IGamePlayRecord>({
  gameId: '',
  hands: List<Hand>(),
  tableFaceDown: List<Card>(),
  tablePile: List<Card>(),
  actions: OrderedMap<string, GamePlayAction>(),
  currentGameConfig: GameConfig.getDefaultConfig(),
  undoneIds: List<string>(),
  idCounter:0
});

export const INITIAL_STATE_GAME_PLAY = GamePlayFactory();

export function gamePlayReducer(oldState: IGamePlayRecord = INITIAL_STATE_GAME_PLAY,
                                action: IPayloadAction) {

  if (!GamePlayActions.isGamePlayAction(action.type))
    return oldState;

  let payload: IGamePlayActionPayload = action.payload;
  if (!payload)
开发者ID:kokokenada,项目名称:for-real-cards,代码行数:32,代码来源:game-play.reducer.ts

示例5: UserFactory

import {
  ISessionRecord,
  ISession,
  IUser,
  IUserRecord,
} from './session.types';
import { makeTypedFactory } from 'typed-immutable-record';


export const UserFactory = makeTypedFactory<IUser, IUserRecord>({
  firstName: null,
  lastName: null
});

export const INITIAL_USER_STATE = UserFactory();

export const SessionFactory = makeTypedFactory<ISession, ISessionRecord>({
  token: null,
  user: INITIAL_USER_STATE,
  hasError: false,
  isLoading: false,
});

export const INITIAL_STATE = SessionFactory();
开发者ID:alexeigo,项目名称:angular2-redux-starter,代码行数:24,代码来源:session.initial-state.ts

示例6: fromJS

export const QuotesFactory = makeTypedFactory<IQuotes, IQuotesRecord>({
  quotes: fromJS({
    isPending: false,
    isSuccess: false,
    isError: false,
    errorCode: 0,
    items: [],
  }),

  saveQuote: fromJS({
    isModalVisible: false,
    isPending: false,
    isSuccess: false,
    isError: false,
    errorCode: 0,
    item: {},
  }),

  updateQuote: fromJS({
    isModalVisible: false,
    isPending: false,
    isSuccess: false,
    isError: false,
    errorCode: 0,
    item: {},
  }),

  removeQuote: fromJS({
    isConfirmVisible: false,
    isPending: false,
    isSuccess: false,
    isError: false,
    errorCode: 0,
    item: {},
  }),

  recommendQuote: fromJS({
    isPending: false,
    isSuccess: false,
    isError: false,
    errorCode: 0,
    item: {},
  }),

  unrecommendQuote: fromJS({
    isPending: false,
    isSuccess: false,
    isError: false,
    errorCode: 0,
    item: {},
  }),
});
开发者ID:rtbm,项目名称:ng2-quottr,代码行数:52,代码来源:quotes.initial-state.ts

示例7: ToggleFactory

import {
  IToggleRecord,
  IToggle, IFeatureToggleConfigSet,
} from './feature-toggle-types';
import { makeTypedFactory } from 'typed-immutable-record';

const defaultToggle = {};

export const ToggleFactory = makeTypedFactory<IToggle, IToggleRecord>(
  defaultToggle
);

export const INITIAL_STATE = ToggleFactory();

export function fromConfig(configSet: IFeatureToggleConfigSet) {
  let justTheValues = {};
  for (let prop in configSet) {
    justTheValues[prop] = configSet[prop].setting;
  }
  return makeTypedFactory<IToggle, IToggleRecord>(justTheValues)();
}
开发者ID:kokokenada,项目名称:common-app,代码行数:21,代码来源:feature-toggle-initial-state.ts

示例8: ExerciseFactory

import {
  IExerciseRecord,
  IExercise,
} from './exercise.types';
import { makeTypedFactory } from 'typed-immutable-record';

export const ExerciseFactory = makeTypedFactory<IExercise, IExerciseRecord>({
  id: null,
  name: null,
  bodypart: null
});

export const INITIAL_STATE = ExerciseFactory();
开发者ID:rawkamatic,项目名称:workoutbuddy,代码行数:13,代码来源:exercise.initial-state.ts

示例9: fromJS

  IUser,
} from './user.types';

export const UserFactory = makeTypedFactory<IUser, IUserRecord>({
  id_token: '',
  user: fromJS({}),

  signup: fromJS({
    isPending: false,
    isSuccess: false,
    isError: false,
    errorCode: 0,
  }),

  signin: fromJS({
    isPending: false,
    isSuccess: false,
    isError: false,
    errorCode: 0,
  }),

  resetPassword: fromJS({
    isPending: false,
    isSuccess: false,
    isError: false,
    errorCode: 0,
  }),
});

export const INITIAL_STATE = UserFactory();
开发者ID:rtbm,项目名称:ng2-quottr,代码行数:30,代码来源:user.initial-state.ts

示例10: fromJS

  IUsers,
} from './users.types';

export const UsersFactory = makeTypedFactory<IUsers, IUsersRecord>({
  users: fromJS({
    isPending: false,
    isSuccess: false,
    isError: false,
    errorCode: 0,
    items: [],
  }),

  follow: fromJS({
    isPending: false,
    isSuccess: false,
    isError: false,
    errorCode: 0,
    item: {},
  }),

  unfollow: fromJS({
    isPending: false,
    isSuccess: false,
    isError: false,
    errorCode: 0,
    item: {},
  }),
});

export const INITIAL_STATE = UsersFactory();
开发者ID:rtbm,项目名称:ng2-quottr,代码行数:30,代码来源:users.initial-state.ts


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