本文整理汇总了TypeScript中object-assign.default函数的典型用法代码示例。如果您正苦于以下问题:TypeScript default函数的具体用法?TypeScript default怎么用?TypeScript default使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了default函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: reducer
export default function reducer(state: BlueprintsState = initialState, action: any = {}) {
switch (action.type) {
case SELECT_BLUEPRINT:
return assign({}, state, {
selected: action.blueprint
});
case ADD_BLUEPRINT:
return assign({}, state, {
blueprints: [...state.blueprints, action.blueprint]
});
case ADD_BLUEPRINT_ICON:
action.blueprint.icon = action.icon;
return assign({}, state, {
blueprints: [...state.blueprints]
});
case REMOVE_BLUEPRINT:
return assign({}, state, {
blueprints: remove(state.blueprints, 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:Ortu-,项目名称:Camelot-Unchained,代码行数:27,代码来源:blueprints.ts
示例2: 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:Fidaman,项目名称:Camelot-Unchained,代码行数:26,代码来源:lights.ts
示例3: reducer
export default function reducer(state: MaterialsReplaceState = initialState, action: any = {}) {
switch (action.type) {
case SELECT_FROM_MATERIAL:
return assign({}, state, {
from: action.selectedMaterial,
});
case SELECT_TO_MATERIAL:
return assign({}, state, {
to: action.selectedMaterial,
});
default: return state;
}
}
开发者ID:Ortu-,项目名称:Camelot-Unchained,代码行数:13,代码来源:materials-replace.ts
示例4: mergeMap
mergeMap((arg) : Observable<IPipelineLoaderEvent<T, U>> => {
// "cache": data taken from cache by the pipeline
// "data": the data is available but no request has been done
// "response": data received through a request
switch (arg.type) {
case "cache":
case "data":
case "response":
const response$ = observableOf({
type: "response" as "response",
value: objectAssign({}, resolverResponse, {
url: arg.type === "response" ? arg.value.url : undefined,
responseData: arg.value.responseData,
sendingTime: arg.type === "response" ?
arg.value.sendingTime : undefined,
receivedTime: arg.type === "response" ?
arg.value.receivedTime : undefined,
}),
});
const metrics$ = arg.type !== "response" ?
EMPTY : observableOf({
type: "metrics" as "metrics",
value: {
size: arg.value.size,
duration: arg.value.duration,
},
});
return observableConcat(response$, metrics$);
default:
return observableOf(arg);
}
}));
开发者ID:canalplus,项目名称:rx-player,代码行数:32,代码来源:create_loader.ts
示例5: 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:Mehuge,项目名称:Camelot-Unchained,代码行数:7,代码来源:building.ts
示例6: parseSegmentList
/**
* @param {Element} root
* @returns {Object}
*/
export default function parseSegmentList(root: Element) : IParsedSegmentList {
const base = parseSegmentBase(root);
const list : IParsedSegmentURL[] = [];
const segmentListChildren = root.childNodes;
for (let i = 0; i < segmentListChildren.length; i++) {
if (segmentListChildren[i].nodeType === Node.ELEMENT_NODE) {
const currentNode = segmentListChildren[i] as Element;
if (currentNode.nodeName === "SegmentURL") {
const segmentURL = parseSegmentURL(currentNode);
list.push(segmentURL);
}
}
}
const baseDuration = base.duration;
if (baseDuration == null) {
throw new Error("Invalid SegmentList: no duration");
}
return objectAssign(base, {
list,
duration: baseDuration, // Ugly but TS is too dumb there
});
}
开发者ID:canalplus,项目名称:rx-player,代码行数:30,代码来源:SegmentList.ts
示例7: assign
const blocks = (state: BlocksState = initialBlocksState, action: any): BlocksState => {
switch(action.type) {
case 'LOAD_BLOCKS':
return assign({}, state, { blocksLoaded: 0 });
case 'RECV_BLOCKS':
return assign({}, state, { blocksLoaded: action.when });
case 'LOAD_BLUEPRINTS':
return assign({}, state, { blueprintsLoaded: 0 });
case 'RECV_BLUEPRINTS':
return assign({}, state, { blueprintsLoaded: action.when });
case 'COPY_BLUEPRINT':
return assign({}, state, { blueprintCopied: action.when });
}
return state;
}
开发者ID:Fidaman,项目名称:cu-ui,代码行数:15,代码来源:Building.ts
示例8: resolveURL
const representations = qualityLevels.map((qualityLevel) => {
const path = resolveURL(rootURL, baseURL);
const repIndex = {
timeline: index.timeline,
timescale: index.timescale,
media: replaceRepresentationSmoothTokens(path, qualityLevel.bitrate),
isLive,
timeShiftBufferDepth,
manifestReceivedTime,
};
const mimeType = qualityLevel.mimeType || DEFAULT_MIME_TYPES[adaptationType];
const codecs = qualityLevel.codecs || DEFAULT_CODECS[adaptationType];
const id = adaptationID + "_" + adaptationType + "-" + mimeType + "-" +
codecs + "-" + qualityLevel.bitrate;
const contentProtections : IContentProtection[] = [];
let firstProtection : IContentProtectionSmooth|undefined;
if (protections.length) {
firstProtection = protections[0];
protections.forEach((protection) => {
const keyId = protection.keyId;
protection.keySystems.forEach((keySystem) => {
contentProtections.push({
keyId,
systemId: keySystem.systemId,
});
});
});
}
const segmentPrivateInfos = {
bitsPerSample: qualityLevel.bitsPerSample,
channels: qualityLevel.channels,
codecPrivateData: qualityLevel.codecPrivateData || "",
packetSize: qualityLevel.packetSize,
samplingRate: qualityLevel.samplingRate,
// TODO set multiple protections here instead of the first one
protection: firstProtection != null ? {
keyId: firstProtection.keyId,
keySystems: firstProtection.keySystems,
} : undefined,
};
const representation : IParsedRepresentation = objectAssign({}, qualityLevel, {
index: new RepresentationIndex(repIndex, {
segmentPrivateInfos,
aggressiveMode: parserOptions.aggressiveMode == null ?
DEFAULT_AGGRESSIVE_MODE : parserOptions.aggressiveMode,
}),
mimeType,
codecs,
id,
});
if (contentProtections.length) {
representation.contentProtections = contentProtections;
}
return representation;
});
开发者ID:canalplus,项目名称:rx-player,代码行数:59,代码来源:create_parser.ts
示例9: objectAssign
Object.keys(rulesConfig).forEach(key => {
if (isPresetRuleKey(key)) {
// <preset>/<rule>
objectAssign(filteredConfig, mapRulesConfig(rulesConfig[key], key));
return;
}
filteredConfig[key] = rulesConfig[key];
});
开发者ID:,项目名称:,代码行数:8,代码来源:
注:本文中的object-assign.default函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论