本文整理汇总了TypeScript中redux-typed-modules.Module类的典型用法代码示例。如果您正苦于以下问题:TypeScript Module类的具体用法?TypeScript Module怎么用?TypeScript Module使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Module类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: Module
recipe: null,
possibleItemSlots: undefined,
quality: undefined,
possibleIngredientsForSlot: undefined,
slot: undefined,
ingredients: [],
outputItems: [],
name: null,
message: null,
itemCount: undefined,
count: 0,
};
};
const module = new Module({
initialState: initialState(),
actionExtraData: () => ({ when: new Date() }),
});
export const setJobType = module.createAction({
type: 'crafting/job/set-job',
action: (jobType: string) => ({ jobType }),
reducer: (s, a) => ({ type: a.jobType }),
});
export const setStatus = module.createAction({
type: 'crafting/job/set-status',
action: (status: string) => ({ status }),
reducer: (s, a) => ({ status: a.status }),
});
export const setCount = module.createAction({
示例2: Module
}
/////////////////////////////////
// Module
/////////////////////////////////
const module = new Module({
initialState: getInitialState(),
actionExtraData: () => {
const screen: Size = { width: window.innerWidth, height: window.innerHeight };
return {
when: new Date(),
screen,
};
},
postReducer: (state) => {
const screen: Size = { width: window.innerWidth, height: window.innerHeight };
return {
...state,
lastScreenSize: screen,
};
},
});
/////////////////////////////////
// Actions
/////////////////////////////////
// NO OP -- #TODO: do I really need this?
const init = module.createAction({
示例3: getInitialState
SET_FILTER_BUTTONS: 'charactersheets-inventory-SET_FILTER_BUTTONS',
};
export interface FilterButtonState {
filterButtons: InventoryFilterButton[];
}
export function getInitialState() {
const initialState: FilterButtonState = {
filterButtons: defaultFilterButtonIcons,
};
return initialState;
}
export const module = new Module({
initialState: getInitialState(),
});
export const setFilterButtons = module.createAction({
type: types.SET_FILTER_BUTTONS,
action: (action: { filterButtons: InventoryFilterButton[] }) => action,
reducer: (state, action) => {
const filterButtons = action.filterButtons;
return {
filterButtons,
};
},
});
export default module.createReducer();
示例4: Module
}
}
for (const key in servers) {
servers[key].characterCount = characterCounts[servers[key].shardID];
}
return servers;
}
// ACTIONS
let channelUpdateInterval: NodeJS.Timer = null;
const module = new Module({
initialState: initialState(),
actionExtraData: () => {
return {
when: new Date(),
};
},
});
function onStartPatcherSignalR(dispatch: (action: ControllerAction) => any) {
registerPatcherHubEvents(dispatch);
dispatch(initSignalRSuccess() as ControllerAction);
dispatch(getChannels());
// update channel info on a timer...
if (channelUpdateInterval === null) {
channelUpdateInterval = setInterval(() => dispatch(getChannels()), 500);
}
}
示例5: Module
raceBoons: {},
factionBoons: {},
generalBanes: {},
playerClassBanes: {},
raceBanes: {},
factionBanes: {},
allPrerequisites: {},
allExclusives: {},
minPoints: 0,
maxPoints: 0,
};
return initialState;
}
export const module = new Module({
initialState: getInitialState(),
});
export const onSelectBane = module.createAction({
type: 'cu-character-creation/banes-and-boons/ON_SELECT_BANE',
action: (action: { bane: BanesAndBoonsInfo }) => action,
reducer: (state, action) => {
const addedBanes = state.addedBanes;
const traits = state.traits;
addedBanes[action.bane.id] = action.bane.id;
traits[action.bane.id] = { ...action.bane, selected: true };
return {
traits,
addedBanes,
totalPoints: state.totalPoints + action.bane.points,
};
示例6: getInitialState
stack?: InventoryItem.Fragment[];
}
export interface InventoryState {
itemSlots: ItemSlot[];
}
export function getInitialState() {
const initialState: InventoryState = {
itemSlots: [],
};
return initialState;
}
export const module = new Module({
initialState: getInitialState(),
});
export const setItemSlots = module.createAction({
type: types.SET_ITEM_SLOTS,
action: (action: { itemSlots: ItemSlot[] }) => action,
reducer: (state, action) => {
const { itemSlots } = action;
return {
itemSlots,
};
},
});
export default module.createReducer();
示例7: Module
}
/////////////////////////////////
// Module
/////////////////////////////////
const module = new Module({
initialState: getInitialState(),
actionExtraData: () => {
const screen: Size = { width: window.innerWidth, height: window.innerHeight };
return {
when: new Date(),
screen: screen
};
},
postReducer: (state) => {
const screen: Size = { width: window.innerWidth, height: window.innerHeight };
return {
...state,
lastScreenSize: screen
}
}
});
/////////////////////////////////
// Actions
/////////////////////////////////
// NO OP -- #TODO: do I really need this?
const init = module.createAction({
示例8: Module
shape: Recipe[];
block: Recipe[];
}
export const initialState = (): RecipesState => {
return {
updating: 0,
purify: [],
grind: [],
shape: [],
block: [],
};
};
const module = new Module({
initialState: initialState(),
actionExtraData: () => ({ when: new Date() }),
});
function mapVoxRecipesToRecipes(voxRecipes: VoxRecipe[]): Recipe[] {
return voxRecipes.map((r: VoxRecipe) => {
const item: any = r.outputItem || { name: r.id };
return {
id: r.id,
name: item.name,
icon: item.iconUrl,
description: item.description,
};
});
}
function mapPurifyRecipesToRecipes(voxRecipes: VoxRecipe[]): Recipe[] {
示例9: Module
remaining: number; // crafting timer
minimized: boolean; // minimized?
}
export const initialState = (): UIState => {
return {
mode: 'crafting',
remaining: 0,
minimized: false,
};
};
const module = new Module({
initialState: initialState(),
actionExtraData: () => {
return {
when: new Date(),
};
},
});
export const setUIMode = module.createAction({
type: 'crafting/ui/mode',
action: (mode: string) => {
return { mode };
},
reducer: (s, a) => {
return { mode: a.mode };
},
});
export const setRemaining = module.createAction({