summaryrefslogtreecommitdiffstats
path: root/polygerrit-ui/app/elements/plugins/gr-endpoint-param/gr-endpoint-param.ts
blob: 5a00c37923d9dfe966f130c9e944f5c779740432 (plain)
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
/**
 * @license
 * Copyright 2017 Google LLC
 * SPDX-License-Identifier: Apache-2.0
 */
import {LitElement, PropertyValues} from 'lit';
import {customElement, property} from 'lit/decorators';

declare global {
  interface HTMLElementTagNameMap {
    'gr-endpoint-param': GrEndpointParam;
  }
}

@customElement('gr-endpoint-param')
export class GrEndpointParam extends LitElement {
  @property({type: String, reflect: true})
  name = '';

  @property({type: Object})
  value?: unknown;

  override willUpdate(changedProperties: PropertyValues) {
    if (changedProperties.has('value')) {
      this.dispatchEvent(
        new CustomEvent('value-changed', {detail: {value: this.value}})
      );
    }
  }
}