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


TypeScript lang.Json類代碼示例

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


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

示例1: it

 it('should write all data into a file', inject([AsyncTestCompleter], (async) => {
      createReporter({
        sampleId: 'someId',
        descriptions: [{'a': 2}],
        path: 'somePath',
        metrics: {'script': 'script time'}
      })
          .reportSample(
              [mv(0, 0, {'a': 3, 'b': 6})],
              [mv(0, 0, {'a': 3, 'b': 6}), mv(1, 1, {'a': 5, 'b': 9})]);
      var regExp = /somePath\/someId_\d+\.json/g;
      expect(isPresent(RegExpWrapper.firstMatch(regExp, loggedFile['filename']))).toBe(true);
      var parsedContent = Json.parse(loggedFile['content']);
      expect(parsedContent).toEqual({
        'description':
            {'id': 'someId', 'description': {'a': 2}, 'metrics': {'script': 'script time'}},
        'completeSample': [
          {'timeStamp': '1970-01-01T00:00:00.000Z', 'runIndex': 0, 'values': {'a': 3, 'b': 6}}
        ],
        'validSample': [
          {'timeStamp': '1970-01-01T00:00:00.000Z', 'runIndex': 0, 'values': {'a': 3, 'b': 6}}, {
            'timeStamp': '1970-01-01T00:00:00.001Z',
            'runIndex': 1,
            'values': {'a': 5, 'b': 9}
          }
        ]
      });
      async.done();
    }));
開發者ID:chong999,項目名稱:angular,代碼行數:29,代碼來源:json_file_reporter_spec.ts

示例2: BaseException

 entries.forEach(entry => {
   var message = Json.parse(entry['message'])['message'];
   if (StringWrapper.equals(message['method'], 'Tracing.dataCollected')) {
     events.push(message['params']);
   }
   if (StringWrapper.equals(message['method'], 'Tracing.bufferUsage')) {
     throw new BaseException('The DevTools trace buffer filled during the test!');
   }
 });
開發者ID:chong999,項目名稱:angular,代碼行數:9,代碼來源:chrome_driver_extension.ts

示例3: reportSample

 reportSample(completeSample: MeasureValues[], validSample: MeasureValues[]): Promise<any> {
   var content = Json.stringify({
     'description': this._description,
     'completeSample': completeSample,
     'validSample': validSample
   });
   var filePath =
       `${this._path}/${this._description.id}_${DateWrapper.toMillis(this._now())}.json`;
   return this._writeFile(filePath, content);
 }
開發者ID:chong999,項目名稱:angular,代碼行數:10,代碼來源:json_file_reporter.ts

示例4:

 return Promise.resolve(this._perfRecords.map(function(record) {
   return {
     'message': Json.stringify(
         {'message': {'method': 'Timeline.eventRecorded', 'params': {'record': record}}})
   };
 }));
開發者ID:Jake-Church,項目名稱:angular,代碼行數:6,代碼來源:ios_driver_extension_spec.ts

示例5:

 entries.forEach(entry => {
   var message = Json.parse(entry['message'])['message'];
   if (StringWrapper.equals(message['method'], 'Timeline.eventRecorded')) {
     records.push(message['params']['record']);
   }
 });
開發者ID:xavier268,項目名稱:angular,代碼行數:6,代碼來源:ios_driver_extension.ts

示例6:

 return PromiseWrapper.resolve(this._events.map((event) => {
   return {
     'message': Json.stringify({'message': {'method': this._messageMethod, 'params': event}})
   };
 }));
開發者ID:chong999,項目名稱:angular,代碼行數:5,代碼來源:chrome_driver_extension_spec.ts


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