1
    2
    3
    4
    5
    6
    7
    8
    9
   10
   11
   12
   13
   14
   15
   16
   17
   18
   19
   20
   21
   22
   23
   24
   25
   26
   27
   28
   29
   30
   31
   32
   33
   34

content / browser / resources / webxr_internals / device_info_table.ts [blame]

// Copyright 2023 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import {CustomElement} from 'chrome://resources/js/custom_element.js';

import {getTemplate} from './device_info_table.html.js';

export class DeviceInfoTableElement extends CustomElement {
  static override get template() {
    return getTemplate();
  }

  addRow(property: string, value: string) {
    const table =
        this.getRequiredElement<HTMLTableElement>('#device-info-table');

    const newRow = table.insertRow();
    const propertyCell = newRow.insertCell();
    const valueCell = newRow.insertCell();

    propertyCell.textContent = property;
    valueCell.textContent = value;
  }
}

// Declare the custom element
declare global {
  interface HTMLElementTagNameMap {
    'device-info-table': DeviceInfoTableElement;
  }
}

customElements.define('device-info-table', DeviceInfoTableElement);