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


TypeScript facade.isPresent函数代码示例

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


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

示例1: 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:0xJoKe,项目名称:angular,代码行数:31,代码来源:ios_driver_extension.ts

示例2: _iterate

 _iterate(lastState): Promise<SampleState> {
   var resultPromise: Promise<any>;
   if (isPresent(this._prepare)) {
     resultPromise = this._driver.waitFor(this._prepare);
   } else {
     resultPromise = PromiseWrapper.resolve(null);
   }
   if (isPresent(this._prepare) || lastState.completeSample.length === 0) {
     resultPromise = resultPromise.then((_) => this._metric.beginMeasure());
   }
   return resultPromise.then((_) => this._driver.waitFor(this._execute))
       .then((_) => this._metric.endMeasure(isBlank(this._prepare)))
       .then((measureValues) => this._report(lastState, measureValues));
 }
开发者ID:0xJoKe,项目名称:angular,代码行数:14,代码来源:sampler.ts

示例3: bindAction

 bindAction('#reset-btn', () => {
   this._getScrollDiv().scrollTop = 0;
   var existingMarker = this._locateFinishedMarker();
   if (isPresent(existingMarker)) {
     DOM.removeChild(document.body, existingMarker);
   }
 });
开发者ID:0xJoKe,项目名称:angular,代码行数:7,代码来源:app.ts

示例4: timeEnd

 timeEnd(name: string, restartName: string = null): Promise<any> {
   var script = 'window.markEnd("' + name + '");';
   if (isPresent(restartName)) {
     script += 'window.markStart("' + restartName + '");';
   }
   return this._driver.executeScript(script);
 }
开发者ID:0xJoKe,项目名称:angular,代码行数:7,代码来源:firefox_driver_extension.ts

示例5: timeEnd

 timeEnd(name: string, restartName: string = null): Promise<any> {
   var script = `console.timeEnd('${name}');`;
   if (isPresent(restartName)) {
     script += `console.time('${restartName}');`
   }
   return this._driver.executeScript(script);
 }
开发者ID:0xJoKe,项目名称:angular,代码行数:7,代码来源:ios_driver_extension.ts

示例6: loop

 return this._iterate(lastState).then((newState) => {
   if (isPresent(newState.validSample)) {
     return newState;
   } else {
     return loop(newState);
   }
 });
开发者ID:0xJoKe,项目名称:angular,代码行数:7,代码来源:sampler.ts

示例7: sample

  sample({id, execute, prepare, microMetrics, providers, userMetrics}:
             {id: string, execute?: any, prepare?: any, microMetrics?: any, providers?: any, userMetrics?: any}):
      Promise<SampleState> {
    var sampleProviders = [
      _DEFAULT_PROVIDERS,
      this._defaultProviders,
      {provide: Options.SAMPLE_ID, useValue: id},
      {provide: Options.EXECUTE, useValue: execute}
    ];
    if (isPresent(prepare)) {
      sampleProviders.push({provide: Options.PREPARE, useValue: prepare});
    }
    if (isPresent(microMetrics)) {
      sampleProviders.push({provide: Options.MICRO_METRICS, useValue: microMetrics});
    }
    if (isPresent(userMetrics)) {
      sampleProviders.push({provide: Options.USER_METRICS, useValue: userMetrics});
    }
    if (isPresent(providers)) {
      sampleProviders.push(providers);
    }

    var inj = ReflectiveInjector.resolveAndCreate(sampleProviders);
    var adapter = inj.get(WebDriverAdapter);

    return PromiseWrapper
        .all([adapter.capabilities(), adapter.executeScript('return window.navigator.userAgent;')])
        .then((args) => {
          var capabilities = args[0];
          var userAgent = args[1];

          // This might still create instances twice. We are creating a new injector with all the
          // providers.
          // Only WebDriverAdapter is reused.
          // TODO vsavkin consider changing it when toAsyncFactory is added back or when child
          // injectors are handled better.
          var injector = ReflectiveInjector.resolveAndCreate([
            sampleProviders,
            {provide: Options.CAPABILITIES, useValue: capabilities},
            {provide: Options.USER_AGENT, useValue: userAgent},
            {provide: WebDriverAdapter, useValue: adapter}
          ]);

          var sampler = injector.get(Sampler);
          return sampler.sample();
        });
  }
开发者ID:4vanger,项目名称:angular,代码行数:47,代码来源:runner.ts

示例8: 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 bindings = [
     Options.DEFAULT_PROVIDERS,
     PerflogMetric.BINDINGS,
     bind(Options.MICRO_METRICS).toValue(microMetrics),
     bind(PerflogMetric.SET_TIMEOUT)
         .toValue((fn, millis) => {
           commandLog.push(['setTimeout', millis]);
           fn();
         }),
     bind(WebDriverExtension)
         .toValue(new MockDriverExtension(perfLogs, commandLog, perfLogFeatures))
   ];
   if (isPresent(forceGc)) {
     bindings.push(bind(Options.FORCE_GC).toValue(forceGc));
   }
   if (isPresent(captureFrames)) {
     bindings.push(bind(Options.CAPTURE_FRAMES).toValue(captureFrames));
   }
   if (isPresent(receivedData)) {
     bindings.push(bind(Options.RECEIVED_DATA).toValue(receivedData));
   }
   if (isPresent(requestCount)) {
     bindings.push(bind(Options.REQUEST_COUNT).toValue(requestCount));
   }
   return ReflectiveInjector.resolveAndCreate(bindings).get(PerflogMetric);
 }
开发者ID:2blessed2bstressedbythedevilsmess,项目名称:angular,代码行数:42,代码来源:perflog_metric_spec.ts

示例9: _report

 _report(state: SampleState, metricValues: {[key: string]: any}): Promise<SampleState> {
   var measureValues = new MeasureValues(state.completeSample.length, this._now(), metricValues);
   var completeSample = state.completeSample.concat([measureValues]);
   var validSample = this._validator.validate(completeSample);
   var resultPromise = this._reporter.reportMeasureValues(measureValues);
   if (isPresent(validSample)) {
     resultPromise =
         resultPromise.then((_) => this._reporter.reportSample(completeSample, validSample))
   }
   return resultPromise.then((_) => new SampleState(completeSample, validSample));
 }
开发者ID:0xJoKe,项目名称:angular,代码行数:11,代码来源:sampler.ts

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


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