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


TypeScript lang.isBlank函数代码示例

本文整理汇总了TypeScript中@angular/facade/src/lang.isBlank函数的典型用法代码示例。如果您正苦于以下问题:TypeScript isBlank函数的具体用法?TypeScript isBlank怎么用?TypeScript isBlank使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: _processAsPreChrome45Event

 private _processAsPreChrome45Event(event, categories, majorGCPids) {
   var name = event['name'];
   var args = event['args'];
   var pid = event['pid'];
   var ph = event['ph'];
   if (this._isEvent(
           categories, name, ['disabled-by-default-devtools.timeline'], 'FunctionCall') &&
       (isBlank(args) || isBlank(args['data']) ||
        !StringWrapper.equals(args['data']['scriptName'], 'InjectedScript'))) {
     return normalizeEvent(event, {'name': 'script'});
   } else if (
       this._isEvent(
           categories, name, ['disabled-by-default-devtools.timeline'], 'RecalculateStyles') ||
       this._isEvent(categories, name, ['disabled-by-default-devtools.timeline'], 'Layout') ||
       this._isEvent(
           categories, name, ['disabled-by-default-devtools.timeline'], 'UpdateLayerTree') ||
       this._isEvent(categories, name, ['disabled-by-default-devtools.timeline'], 'Paint')) {
     return normalizeEvent(event, {'name': 'render'});
   } else if (this._isEvent(
                  categories, name, ['disabled-by-default-devtools.timeline'], 'GCEvent')) {
     var normArgs = {
       'usedHeapSize': isPresent(args['usedHeapSizeAfter']) ? args['usedHeapSizeAfter'] :
                                                              args['usedHeapSizeBefore']
     };
     if (StringWrapper.equals(ph, 'E')) {
       normArgs['majorGc'] = isPresent(majorGCPids[pid]) && majorGCPids[pid];
     }
     majorGCPids[pid] = false;
     return normalizeEvent(event, {'name': 'gc', 'args': normArgs});
   } else if (
       this._isEvent(categories, name, ['v8'], 'majorGC') && StringWrapper.equals(ph, 'B')) {
     majorGCPids[pid] = true;
   }
   return null;  // nothing useful in this event
 }
开发者ID:chong999,项目名称:angular,代码行数:35,代码来源:chrome_driver_extension.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: createEndEvent

    records.forEach((record) => {
      var endEvent = null;
      var type = record['type'];
      var data = record['data'];
      var startTime = record['startTime'];
      var endTime = record['endTime'];

      if (StringWrapper.equals(type, 'FunctionCall') &&
          (isBlank(data) || !StringWrapper.equals(data['scriptName'], 'InjectedScript'))) {
        events.push(createStartEvent('script', startTime));
        endEvent = createEndEvent('script', endTime);
      } else if (StringWrapper.equals(type, 'Time')) {
        events.push(createMarkStartEvent(data['message'], startTime));
      } else if (StringWrapper.equals(type, 'TimeEnd')) {
        events.push(createMarkEndEvent(data['message'], startTime));
      } else if (
          StringWrapper.equals(type, 'RecalculateStyles') || StringWrapper.equals(type, 'Layout') ||
          StringWrapper.equals(type, 'UpdateLayerTree') || StringWrapper.equals(type, 'Paint') ||
          StringWrapper.equals(type, 'Rasterize') ||
          StringWrapper.equals(type, 'CompositeLayers')) {
        events.push(createStartEvent('render', startTime));
        endEvent = createEndEvent('render', endTime);
      }
      // Note: ios used to support GCEvent up until iOS 6 :-(
      if (isPresent(record['children'])) {
        this._convertPerfRecordsToEvents(record['children'], events);
      }
      if (isPresent(endEvent)) {
        events.push(endEvent);
      }
    });
开发者ID:xavier268,项目名称:angular,代码行数:31,代码来源:ios_driver_extension.ts

示例4: _update

function _update(node: TreeNode<UrlSegment>, changes: any[]): TreeNode<UrlSegment> {
  let rest = changes.slice(1);
  let outlet = _outlet(changes);
  let segment = _segment(changes);
  if (isString(segment) && segment[0] == "/") segment = segment.substring(1);

  // reach the end of the tree => create new tree nodes.
  if (isBlank(node)) {
    let urlSegment = new UrlSegment(segment, null, outlet);
    let children = rest.length === 0 ? [] : [_update(null, rest)];
    return new TreeNode<UrlSegment>(urlSegment, children);

    // different outlet => preserve the subtree
  } else if (outlet != node.value.outlet) {
    return node;

    // same outlet => modify the subtree
  } else {
    let urlSegment = isStringMap(segment) ? new UrlSegment(null, segment, null) :
                                            new UrlSegment(segment, null, outlet);
    if (rest.length === 0) {
      return new TreeNode<UrlSegment>(urlSegment, []);
    }

    return new TreeNode<UrlSegment>(urlSegment,
                                    _updateMany(ListWrapper.clone(node.children), rest));
  }
}
开发者ID:davewragg,项目名称:angular,代码行数:28,代码来源:link.ts

示例5: _isEvent

 private _isEvent(
     eventCategories: string[], eventName: string, expectedCategories: string[],
     expectedName: string = null): boolean {
   var hasCategories = expectedCategories.reduce(
       (value, cat) => { return value && ListWrapper.contains(eventCategories, cat); }, true);
   return isBlank(expectedName) ? hasCategories :
                                  hasCategories && StringWrapper.equals(eventName, expectedName);
 }
开发者ID:chong999,项目名称:angular,代码行数:8,代码来源:chrome_driver_extension.ts

示例6: _serializeChildren

function _serializeChildren(node: TreeNode<UrlSegment>): string {
  if (node.children.length > 0) {
    let slash = isBlank(node.children[0].value.segment) ? "" : "/";
    return `${slash}${_serializeUrlTreeNodes(node.children)}`;
  } else {
    return "";
  }
}
开发者ID:davewragg,项目名称:angular,代码行数:8,代码来源:router_url_serializer.ts

示例7: createMetric

 function createMetric(
     perfLogs, perfLogFeatures,
     {microMetrics, forceGc, captureFrames, receivedData, requestCount}: {
       microMetrics?: {[key: string]: string},
       forceGc?: boolean,
       captureFrames?: boolean,
       receivedData?: boolean,
       requestCount?: boolean
     } = {}): Metric {
   commandLog = [];
   if (isBlank(perfLogFeatures)) {
     perfLogFeatures =
         new PerfLogFeatures({render: true, gc: true, frameCapture: true, userTiming: true});
   }
   if (isBlank(microMetrics)) {
     microMetrics = StringMapWrapper.create();
   }
   var providers: Provider[] = [
     Options.DEFAULT_PROVIDERS, PerflogMetric.PROVIDERS,
     {provide: Options.MICRO_METRICS, useValue: microMetrics}, {
       provide: PerflogMetric.SET_TIMEOUT,
       useValue: (fn, millis) => {
         commandLog.push(['setTimeout', millis]);
         fn();
       },
     },
     {
       provide: WebDriverExtension,
       useValue: new MockDriverExtension(perfLogs, commandLog, perfLogFeatures)
     }
   ];
   if (isPresent(forceGc)) {
     providers.push({provide: Options.FORCE_GC, useValue: forceGc});
   }
   if (isPresent(captureFrames)) {
     providers.push({provide: Options.CAPTURE_FRAMES, useValue: captureFrames});
   }
   if (isPresent(receivedData)) {
     providers.push({provide: Options.RECEIVED_DATA, useValue: receivedData});
   }
   if (isPresent(requestCount)) {
     providers.push({provide: Options.REQUEST_COUNT, useValue: requestCount});
   }
   return ReflectiveInjector.resolveAndCreate(providers).get(PerflogMetric);
 }
开发者ID:xavier268,项目名称:angular,代码行数:45,代码来源:perflog_metric_spec.ts

示例8: _findUrlSegment

function _findUrlSegment(segment: RouteSegment, routeTree: RouteTree): UrlSegment {
  let s = segment;
  let res = null;
  while (isBlank(res)) {
    res = ListWrapper.last(s.urlSegments);
    s = routeTree.parent(s);
  }
  return res;
}
开发者ID:davewragg,项目名称:angular,代码行数:9,代码来源:link.ts

示例9: _processAsPostChrome44Event

 private _processAsPostChrome44Event(event, categories) {
   var name = event['name'];
   var args = event['args'];
   if (this._isEvent(categories, name, ['devtools.timeline', 'v8'], 'MajorGC')) {
     var normArgs = {
       'majorGc': true,
       'usedHeapSize': isPresent(args['usedHeapSizeAfter']) ? args['usedHeapSizeAfter'] :
                                                              args['usedHeapSizeBefore']
     };
     return normalizeEvent(event, {'name': 'gc', 'args': normArgs});
   } else if (this._isEvent(categories, name, ['devtools.timeline', 'v8'], 'MinorGC')) {
     var normArgs = {
       'majorGc': false,
       'usedHeapSize': isPresent(args['usedHeapSizeAfter']) ? args['usedHeapSizeAfter'] :
                                                              args['usedHeapSizeBefore']
     };
     return normalizeEvent(event, {'name': 'gc', 'args': normArgs});
   } else if (
       this._isEvent(categories, name, ['devtools.timeline', 'v8'], 'FunctionCall') &&
       (isBlank(args) || isBlank(args['data']) ||
        (!StringWrapper.equals(args['data']['scriptName'], 'InjectedScript') &&
         !StringWrapper.equals(args['data']['scriptName'], '')))) {
     return normalizeEvent(event, {'name': 'script'});
   } else if (this._isEvent(
                  categories, name, ['devtools.timeline', 'blink'], 'UpdateLayoutTree')) {
     return normalizeEvent(event, {'name': 'render'});
   } else if (
       this._isEvent(categories, name, ['devtools.timeline'], 'UpdateLayerTree') ||
       this._isEvent(categories, name, ['devtools.timeline'], 'Layout') ||
       this._isEvent(categories, name, ['devtools.timeline'], 'Paint')) {
     return normalizeEvent(event, {'name': 'render'});
   } else if (this._isEvent(categories, name, ['devtools.timeline'], 'ResourceReceivedData')) {
     let normArgs = {'encodedDataLength': args['data']['encodedDataLength']};
     return normalizeEvent(event, {'name': 'receivedData', 'args': normArgs});
   } else if (this._isEvent(categories, name, ['devtools.timeline'], 'ResourceSendRequest')) {
     let data = args['data'];
     let normArgs = {'url': data['url'], 'method': data['requestMethod']};
     return normalizeEvent(event, {'name': 'sendRequest', 'args': normArgs});
   } else if (this._isEvent(categories, name, ['blink.user_timing'], 'navigationStart')) {
     return normalizeEvent(event, {'name': name});
   }
   return null;  // nothing useful in this event
 }
开发者ID:chong999,项目名称:angular,代码行数:43,代码来源:chrome_driver_extension.ts

示例10: normalizeEvent

function normalizeEvent(
    chromeEvent: {[key: string]: any}, data: {[key: string]: any}): {[key: string]: any} {
  var ph = chromeEvent['ph'];
  if (StringWrapper.equals(ph, 'S')) {
    ph = 'b';
  } else if (StringWrapper.equals(ph, 'F')) {
    ph = 'e';
  }
  var result =
      {'pid': chromeEvent['pid'], 'ph': ph, 'cat': 'timeline', 'ts': chromeEvent['ts'] / 1000};
  if (chromeEvent['ph'] === 'X') {
    var dur = chromeEvent['dur'];
    if (isBlank(dur)) {
      dur = chromeEvent['tdur'];
    }
    result['dur'] = isBlank(dur) ? 0.0 : dur / 1000;
  }
  StringMapWrapper.forEach(data, (value, prop) => { result[prop] = value; });
  return result;
}
开发者ID:chong999,项目名称:angular,代码行数:20,代码来源:chrome_driver_extension.ts


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