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

TypeScript redux-typed-modules.Module类代码示例

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

本文整理汇总了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({
开发者ID:Mehuge,项目名称:Camelot-Unchained,代码行数:32,代码来源:job.ts


示例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({
开发者ID:Mehuge,项目名称:Camelot-Unchained,代码行数:31,代码来源:layout.ts


示例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();
开发者ID:Mehuge,项目名称:Camelot-Unchained,代码行数:30,代码来源:filterButtonState.ts


示例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);
  }
}
开发者ID:codecorsair,项目名称:Camelot-Unchained,代码行数:31,代码来源:controller.ts


示例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,
    };
开发者ID:JoelTerMeer,项目名称:Camelot-Unchained,代码行数:31,代码来源:banesAndBoons.ts


示例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();
开发者ID:Mehuge,项目名称:Camelot-Unchained,代码行数:30,代码来源:inventoryState.ts


示例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({
开发者ID:Shane7,项目名称:Camelot-Unchained,代码行数:31,代码来源:layout.ts


示例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[] {
开发者ID:Mehuge,项目名称:Camelot-Unchained,代码行数:32,代码来源:recipes.ts


示例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({
开发者ID:Mehuge,项目名称:Camelot-Unchained,代码行数:32,代码来源:ui.ts



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
TypeScript reduxsauce.createActions函数代码示例发布时间:2022-05-25
下一篇:
TypeScript redux-typed.isActionType函数代码示例发布时间: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