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


TypeScript object-assign.default方法代码示例

本文整理汇总了TypeScript中object-assign.default方法的典型用法代码示例。如果您正苦于以下问题:TypeScript object-assign.default方法的具体用法?TypeScript object-assign.default怎么用?TypeScript object-assign.default使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在object-assign的用法示例。


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

示例1: reducer

export default function reducer(state: LightsState = initialState, action: any = {}) {  
  switch (action.type) {
    case SHOW_SELECTOR:
      return assign({}, state, { showLightSelector: action.show });
    case SELECT_LIGHT:
      return assign({}, state, { selectedIndex: action.selectedLight.index });
    case SET_LIGHTS:
      return assign({}, state, {
        lights: action.lights,
        selectedIndex: 0,
      });
    case UPDATE_LIGHT_COLOR:
      setSelectedLight(state, assign({}, getSelectedLight(state), { color: action.color }));
      saveLights(state.lights);
      return assign({}, state, { list: [...state.lights] });
    case UPDATE_LIGHT_RADIUS:
      setSelectedLight(state, assign({}, getSelectedLight(state), { radius: action.radius }));
      saveLights(state.lights);
      return assign({}, state, { list: [...state.lights] });
    case UPDATE_LIGHT_INTENSITY:
      setSelectedLight(state, assign({}, getSelectedLight(state), { intensity: action.intensity }));
      saveLights(state.lights);
      return assign({}, state, { list: [...state.lights] });
    default: return state;
  }
}
开发者ID:JoelTerMeer,项目名称:Camelot-Unchained,代码行数:26,代码来源:lights.ts

示例2: switch

export const trackerStore = (state = initialState, action: Action): TrackerState => {
  switch (action.type) {
    case ActionType.UPDATE_AUTH_FORM:
      return objectAssign({}, state, {loginForm: action.loginForm});
    case ActionType.AUTHENTICATED:
      return objectAssign({}, state, {authenticated: true});
    case ActionType.NOT_AUTHENTICATED:
      return objectAssign({}, state, {authenticated: false});
    case ActionType.SET_CONFIG:
      return objectAssign({}, state, {config: action.config, profileId: action.profileId});
    default:
      return state;
  }
};
开发者ID:halversondm,项目名称:toilet-training-tracker,代码行数:14,代码来源:index.ts

示例3: reducer

export default function reducer(state: BuildingState = initialState, action: any = {}) {
  switch (action.type) {
    case CHANGE_MODE:
      return assign({}, state, { mode: action.mode });
    default: return state;
  }
}
开发者ID:JoelTerMeer,项目名称:Camelot-Unchained,代码行数:7,代码来源:building.ts

示例4: byId

function byId(state: ItemMap = {}, action: Action): ItemMap {
    switch (action.type) {
        case 'RECEIVED_FORUM_POST_UPDATE':
        return objectAssign({}, state, {[action.post.id]: action.post});
        case 'RECEIVED_FORUM_GROUPS':
        case 'RECEIVED_FORUM_TOPIC':
        case 'RECEIVED_FORUM_THREAD':
        case 'RECEIVED_NEWS_POST':
            let map: ItemMap = {};
            for (const item of action.props.data.posts) {
                map[item.id] = item;
            }
            return objectAssign({}, state, map);
        default:
            return state;
    }
}
开发者ID:hwkns,项目名称:streisand,代码行数:17,代码来源:reducer.ts

示例5: reducer

export default function reducer(state: MaterialsReplaceState = initialState, action: any = {}) {
  switch (action.type) {
    case BLOCKS_SELECTED:
      return assign({}, state, {
        blocksSelected: action.selected,
      });
    case SELECT_FROM_MATERIAL:
      return assign({}, state, {
        from: action.selectedMaterial,
      });
    case SELECT_TO_MATERIAL:
      return assign({}, state, {
        to: action.selectedMaterial,
      });
    default: return state;
  }
}
开发者ID:JoelTerMeer,项目名称:Camelot-Unchained,代码行数:17,代码来源:materials-replace.ts

示例6: reducer

export default function reducer(state: BlueprintsState = initialState, action: any = {}) {
  switch (action.type) {
    case UPDATE_BLUEPRINTS:
      return assign({}, state, {
        blueprints: [...action.blueprints],
      });
    case SELECT_BLUEPRINT:
      return assign({}, state, {
        selected: action.blueprint,
      });
    case MODE_CHANGED:
      return assign({}, state, {
        copyable: action.copy === undefined ? state.copyable : action.copy,
        pastable: action.paste === undefined ? state.pastable : action.paste,
      });
    default: return state;
  }
}
开发者ID:JoelTerMeer,项目名称:Camelot-Unchained,代码行数:18,代码来源:blueprints.ts

示例7: processPosts

function processPosts(params: IPostProcessingParams) {
    const { action, count, pageSize } = params;
    const current = params.state[action.props.id] || { count, pageSize, pages: {} };
    const currentPage = current.pages[action.props.page];
    const itemSet: Pages = objectAssign({}, current.pages, {
        [action.props.page]: pageReducer(currentPage, params.action)
    });
    const nestedPage: IItemPages = {
        pages: itemSet,
        count: count !== undefined ? count : current.count,
        pageSize: pageSize !== undefined ? pageSize : current.pageSize
    };
    return objectAssign({}, params.state, {
        [action.props.id]: nestedPage
    });
}
开发者ID:hwkns,项目名称:streisand,代码行数:16,代码来源:reducer.ts

示例8: addGroups

function addGroups(current: ItemMap, groups: IForumGroup[]): ItemMap {
    let map: ItemMap = {};
    for (const item of groups) {
        map[item.id] = objectAssign({}, current[item.id], item);
    }
    return map;
}
开发者ID:hwkns,项目名称:streisand,代码行数:7,代码来源:reducer.ts

示例9: saveLocal

 static saveLocal(data: TrackingBundle): Rx.Subject<string> {
   return recordStore.put(assign({
     _id              : `${data.context.timestamp}-${data.context.href}`,
     navigationTiming : data.navigationTiming,
     chromeLoadTimes  : data.chromeLoadTimes
   }, data.context))
 }
开发者ID:ahomu,项目名称:webperf-collector,代码行数:7,代码来源:tracker.ts

示例10: removeTopic

function removeTopic(group: IForumGroup, topicId: number): IForumGroup {
    if (group && group.topics) {
        const topics = group.topics.filter((topic: number) => {
            return topic !== topicId;
        });
        return objectAssign({}, group, { topics });
    }
    return group;
}
开发者ID:hwkns,项目名称:streisand,代码行数:9,代码来源:reducer.ts


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