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


TypeScript object-assign.default函數代碼示例

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