本文整理汇总了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)();
}
示例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();
示例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,
示例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)
示例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();
示例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: {},
}),
});
示例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)();
}
示例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();
示例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();
示例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();