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


TypeScript lang.NumberWrapper類代碼示例

本文整理匯總了TypeScript中@angular/facade/src/lang.NumberWrapper的典型用法代碼示例。如果您正苦於以下問題:TypeScript NumberWrapper類的具體用法?TypeScript NumberWrapper怎麽用?TypeScript NumberWrapper使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了NumberWrapper類的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1:

 this._printStringRow(this._metricNames.map(metricName => {
   var samples = validSamples.map(measureValues => measureValues.values[metricName]);
   var mean = Statistic.calculateMean(samples);
   var cv = Statistic.calculateCoefficientOfVariation(samples, mean);
   var formattedMean = ConsoleReporter._formatNum(mean);
   // Note: Don't use the unicode character for +- as it might cause
   // hickups for consoles...
   return NumberWrapper.isNaN(cv) ? formattedMean : `${formattedMean}+-${Math.floor(cv)}%`;
 }));
開發者ID:Jake-Church,項目名稱:angular,代碼行數:9,代碼來源:console_reporter.ts

示例2: _parseChromeVersion

 private _parseChromeVersion(userAgent: string): number {
   if (isBlank(userAgent)) {
     return -1;
   }
   var v = StringWrapper.split(userAgent, /Chrom(e|ium)\//g)[2];
   if (isBlank(v)) {
     return -1;
   }
   v = v.split('.')[0];
   if (isBlank(v)) {
     return -1;
   }
   return NumberWrapper.parseInt(v, 10);
 }
開發者ID:chong999,項目名稱:angular,代碼行數:14,代碼來源:chrome_driver_extension.ts

示例3: _formatNum

 /** @internal */
 private static _formatNum(n) { return NumberWrapper.toFixed(n, 2); }
開發者ID:Jake-Church,項目名稱:angular,代碼行數:2,代碼來源:console_reporter.ts

示例4: BaseException

    events.forEach((event) => {
      var ph = event['ph'];
      var name = event['name'];
      var microIterations = 1;
      var microIterationsMatch = RegExpWrapper.firstMatch(_MICRO_ITERATIONS_REGEX, name);
      if (isPresent(microIterationsMatch)) {
        name = microIterationsMatch[1];
        microIterations = NumberWrapper.parseInt(microIterationsMatch[2], 10);
      }

      if (StringWrapper.equals(ph, 'b') && StringWrapper.equals(name, markName)) {
        markStartEvent = event;
      } else if (StringWrapper.equals(ph, 'e') && StringWrapper.equals(name, markName)) {
        markEndEvent = event;
      }

      let isInstant = StringWrapper.equals(ph, 'I') || StringWrapper.equals(ph, 'i');
      if (this._requestCount && StringWrapper.equals(name, 'sendRequest')) {
        result['requestCount'] += 1;
      } else if (this._receivedData && StringWrapper.equals(name, 'receivedData') && isInstant) {
        result['receivedData'] += event['args']['encodedDataLength'];
      } else if (StringWrapper.equals(name, 'navigationStart')) {
        // We count data + requests since the last navigationStart
        // (there might be chrome extensions loaded by selenium before our page, so there
        // will likely be more than one navigationStart).
        if (this._receivedData) {
          result['receivedData'] = 0;
        }
        if (this._requestCount) {
          result['requestCount'] = 0;
        }
      }
      if (isPresent(markStartEvent) && isBlank(markEndEvent) &&
          event['pid'] === markStartEvent['pid']) {
        if (StringWrapper.equals(ph, 'b') && StringWrapper.equals(name, _MARK_NAME_FRAME_CAPUTRE)) {
          if (isPresent(frameCaptureStartEvent)) {
            throw new BaseException('can capture frames only once per benchmark run');
          }
          if (!this._captureFrames) {
            throw new BaseException(
                'found start event for frame capture, but frame capture was not requested in benchpress');
          }
          frameCaptureStartEvent = event;
        } else if (
            StringWrapper.equals(ph, 'e') && StringWrapper.equals(name, _MARK_NAME_FRAME_CAPUTRE)) {
          if (isBlank(frameCaptureStartEvent)) {
            throw new BaseException('missing start event for frame capture');
          }
          frameCaptureEndEvent = event;
        }

        if (isInstant) {
          if (isPresent(frameCaptureStartEvent) && isBlank(frameCaptureEndEvent) &&
              StringWrapper.equals(name, 'frame')) {
            frameTimestamps.push(event['ts']);
            if (frameTimestamps.length >= 2) {
              frameTimes.push(
                  frameTimestamps[frameTimestamps.length - 1] -
                  frameTimestamps[frameTimestamps.length - 2]);
            }
          }
        }

        if (StringWrapper.equals(ph, 'B') || StringWrapper.equals(ph, 'b')) {
          if (isBlank(intervalStarts[name])) {
            intervalStartCount[name] = 1;
            intervalStarts[name] = event;
          } else {
            intervalStartCount[name]++;
          }
        } else if (
            (StringWrapper.equals(ph, 'E') || StringWrapper.equals(ph, 'e')) &&
            isPresent(intervalStarts[name])) {
          intervalStartCount[name]--;
          if (intervalStartCount[name] === 0) {
            var startEvent = intervalStarts[name];
            var duration = (event['ts'] - startEvent['ts']);
            intervalStarts[name] = null;
            if (StringWrapper.equals(name, 'gc')) {
              result['gcTime'] += duration;
              var amount =
                  (startEvent['args']['usedHeapSize'] - event['args']['usedHeapSize']) / 1000;
              result['gcAmount'] += amount;
              var majorGc = event['args']['majorGc'];
              if (isPresent(majorGc) && majorGc) {
                result['majorGcTime'] += duration;
              }
              if (isPresent(intervalStarts['script'])) {
                gcTimeInScript += duration;
              }
            } else if (StringWrapper.equals(name, 'render')) {
              result['renderTime'] += duration;
              if (isPresent(intervalStarts['script'])) {
                renderTimeInScript += duration;
              }
            } else if (StringWrapper.equals(name, 'script')) {
              result['scriptTime'] += duration;
            } else if (isPresent(this._microMetrics[name])) {
              result[name] += duration / microIterations;
            }
//.........這裏部分代碼省略.........
開發者ID:chong999,項目名稱:angular,代碼行數:101,代碼來源:perflog_metric.ts


注:本文中的@angular/facade/src/lang.NumberWrapper類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。