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


TypeScript StringWrapper.equals方法代码示例

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


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

示例1: createStartEvent

    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'))) {
        ListWrapper.push(events, createStartEvent('script', startTime));
        endEvent = createEndEvent('script', endTime);
      } else if (StringWrapper.equals(type, 'Time')) {
        ListWrapper.push(events, createMarkStartEvent(data['message'], startTime));
      } else if (StringWrapper.equals(type, 'TimeEnd')) {
        ListWrapper.push(events, 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')) {
        ListWrapper.push(events, 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)) {
        ListWrapper.push(events, endEvent);
      }
    });
开发者ID:B-Thapa,项目名称:angular,代码行数:31,代码来源:ios_driver_extension.ts

示例2: parseEventName

  static parseEventName(eventName: string): {[key: string]: string} {
    var parts: string[] = eventName.toLowerCase().split('.');

    var domEventName = parts.shift();
    if ((parts.length === 0) ||
        !(StringWrapper.equals(domEventName, 'keydown') ||
          StringWrapper.equals(domEventName, 'keyup'))) {
      return null;
    }

    var key = KeyEventsPlugin._normalizeKey(parts.pop());

    var fullKey = '';
    modifierKeys.forEach(modifierName => {
      if (ListWrapper.contains(parts, modifierName)) {
        ListWrapper.remove(parts, modifierName);
        fullKey += modifierName + '.';
      }
    });
    fullKey += key;

    if (parts.length != 0 || key.length === 0) {
      // returning null instead of throwing to let another plugin process the event
      return null;
    }
    var result = StringMapWrapper.create();
    StringMapWrapper.set(result, 'domEventName', domEventName);
    StringMapWrapper.set(result, 'fullKey', fullKey);
    return result;
  }
开发者ID:0oAimZo0,项目名称:Angular2Learning,代码行数:30,代码来源:key_events.ts

示例3: _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:LordBinary,项目名称:angular,代码行数:35,代码来源:chrome_driver_extension.ts

示例4: parseEventName

  static parseEventName(eventName: string) /* {'domEventName': string, 'fullKey': string} */ {
    var parts = eventName.toLowerCase().split('.');

    var domEventName = ListWrapper.removeAt(parts, 0);
    if ((parts.length === 0) ||
        !(StringWrapper.equals(domEventName, 'keydown') ||
          StringWrapper.equals(domEventName, 'keyup'))) {
      return null;
    }

    var key = KeyEventsPlugin._normalizeKey(ListWrapper.removeLast(parts));

    var fullKey = '';
    ListWrapper.forEach(modifierKeys, (modifierName) => {
      if (ListWrapper.contains(parts, modifierName)) {
        ListWrapper.remove(parts, modifierName);
        fullKey += modifierName + '.';
      }
    });
    fullKey += key;

    if (parts.length != 0 || key.length === 0) {
      // returning null instead of throwing to let another plugin process the event
      return null;
    }

    return {'domEventName': domEventName, 'fullKey': fullKey};
  }
开发者ID:AsherBarak,项目名称:angular,代码行数:28,代码来源:key_events.ts

示例5: _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'});
   }
   return null;  // nothing useful in this event
 }
开发者ID:TedSander,项目名称:angular,代码行数:32,代码来源:chrome_driver_extension.ts

示例6: function

 ListWrapper.forEach(entries, function(entry) {
   var message = Json.parse(entry['message'])['message'];
   if (StringWrapper.equals(message['method'], 'Tracing.dataCollected')) {
     ListWrapper.push(events, message['params']);
   }
   if (StringWrapper.equals(message['method'], 'Tracing.bufferUsage')) {
     throw new BaseException('The DevTools trace buffer filled during the test!');
   }
 });
开发者ID:SnackyPete,项目名称:angular,代码行数:9,代码来源:chrome_driver_extension.ts

示例7: setterFactory

export function setterFactory(property: string): Function {
  var setterFn, styleParts, styleSuffix;
  if (StringWrapper.startsWith(property, ATTRIBUTE_PREFIX)) {
    setterFn = attributeSetterFactory(StringWrapper.substring(property, ATTRIBUTE_PREFIX.length));
  } else if (StringWrapper.startsWith(property, CLASS_PREFIX)) {
    setterFn = classSetterFactory(StringWrapper.substring(property, CLASS_PREFIX.length));
  } else if (StringWrapper.startsWith(property, STYLE_PREFIX)) {
    styleParts = property.split(STYLE_SEPARATOR);
    styleSuffix = styleParts.length > 2 ? ListWrapper.get(styleParts, 2) : '';
    setterFn = styleSetterFactory(ListWrapper.get(styleParts, 1), styleSuffix);
  } else if (StringWrapper.equals(property, 'innerHtml')) {
    if (isBlank(innerHTMLSetterCache)) {
      innerHTMLSetterCache = (el, value) => DOM.setInnerHTML(el, value);
    }
    setterFn = innerHTMLSetterCache;
  } else {
    property = resolvePropertyName(property);
    setterFn = StringMapWrapper.get(propertySettersCache, property);
    if (isBlank(setterFn)) {
      var propertySetterFn = reflector.setter(property);
      setterFn = function(receiver, value) {
        if (DOM.hasProperty(receiver, property)) {
          return propertySetterFn(receiver, value);
        }
      };
      StringMapWrapper.set(propertySettersCache, property, setterFn);
    }
  }
  return setterFn;
}
开发者ID:188799958,项目名称:angular,代码行数:30,代码来源:property_setter_factory.ts

示例8: _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:1186792881,项目名称:angular,代码行数:7,代码来源:chrome_driver_extension.ts

示例9: match

 match(cssSelector, matchedCallback) {
   var result = false;
   var element = cssSelector.element;
   var classNames = cssSelector.classNames;
   var attrs = cssSelector.attrs;
   for (var i = 0; i < this._listContexts.length; i++) {
     this._listContexts[i].alreadyMatched = false;
   }
   result = this._matchTerminal(this._elementMap, element, cssSelector, matchedCallback) || result;
   result = this._matchPartial(this._elementPartialMap, element, cssSelector, matchedCallback) || result;
   if (isPresent(classNames)) {
     for (var index = 0; index < classNames.length; index++) {
       var className = classNames[index];
       result = this._matchTerminal(this._classMap, className, cssSelector, matchedCallback) || result;
       result = this._matchPartial(this._classPartialMap, className, cssSelector, matchedCallback) || result;
     }
   }
   if (isPresent(attrs)) {
     for (var index = 0; index < attrs.length; ) {
       var attrName = attrs[index++];
       var attrValue = attrs[index++];
       var valuesMap = MapWrapper.get(this._attrValueMap, attrName);
       if (!StringWrapper.equals(attrValue, _EMPTY_ATTR_VALUE)) {
         result = this._matchTerminal(valuesMap, _EMPTY_ATTR_VALUE, cssSelector, matchedCallback) || result;
       }
       result = this._matchTerminal(valuesMap, attrValue, cssSelector, matchedCallback) || result;
       valuesMap = MapWrapper.get(this._attrValuePartialMap, attrName);
       result = this._matchPartial(valuesMap, attrValue, cssSelector, matchedCallback) || result;
     }
   }
   return result;
 }
开发者ID:gdi2290,项目名称:sample-Angular2,代码行数:32,代码来源:selector.ts

示例10: _addHostAttribute

 _addHostAttribute(attrName, attrValue, compileElement) {
   if (StringWrapper.equals(attrName, 'class')) {
     ListWrapper.forEach(attrValue.split(' '),
                         (className) => { DOM.addClass(compileElement.element, className); });
   } else if (!DOM.hasAttribute(compileElement.element, attrName)) {
     DOM.setAttribute(compileElement.element, attrName, attrValue);
   }
 }
开发者ID:baraksu,项目名称:angular,代码行数:8,代码来源:directive_parser.ts


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