Upstream version 9.37.197.0
[platform/framework/web/crosswalk.git] / src / tools / telemetry / telemetry / web_components / results_viewer.js
1 // Copyright (c) 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 'use strict';
6
7 tvcm.require('tvcm.ui');
8
9 tvcm.exportTo('telemetry.web_components', function() {
10   /**
11    * @constructor
12    */
13   var ResultsViewer = tvcm.ui.define('x-results-viewer');
14
15   ResultsViewer.prototype = {
16     __proto__: HTMLUnknownElement.prototype,
17
18     decorate: function() {
19       this.dataToView_ = undefined;
20     },
21
22     get dataToView() {
23       return dataToView_;
24     },
25
26     set dataToView(dataToView) {
27       this.dataToView_ = dataToView;
28       this.updateContents_();
29     },
30
31     updateContents_: function() {
32       this.textContent = JSON.stringify(this.dataToView_);
33     }
34   };
35
36   return {
37     ResultsViewer: ResultsViewer
38   };
39 });