當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript redux-typed-modules.Module類代碼示例

本文整理匯總了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;未經允許,請勿轉載。