import Component from '@ember/component';
import { action } from '@ember/object';
import { later } from '@ember/runloop';

export default class CrateTomlCopy extends Component {
  tagName = '';

  showSuccess = false;
  showNotification = false;

  toggleClipboardProps(isSuccess) {
    this.setProperties({
      showSuccess: isSuccess,
      showNotification: true,
    });
    later(
      this,
      () => {
        this.set('showNotification', false);
      },
      2000,
    );
  }

  @action
  copySuccess() {
    this.toggleClipboardProps(true);
  }

  @action
  copyError() {
    this.toggleClipboardProps(false);
  }
}

import Component from '@ember/component';
import { action } from '@ember/object';
import { later } from '@ember/runloop';
import { tracked } from '@glimmer/tracking';

export default class CrateTomlCopy extends Component {
  tagName = '';

  @tracked showSuccess = false;
  @tracked showNotification = false;

  toggleClipboardProps(isSuccess) {
    this.showSuccess = isSuccess;
    this.showNotification = true;

    later(
      this,
      () => {
        this.showNotification = false;
      },
      2000,
    );
  }

  @action
  copySuccess() {
    this.toggleClipboardProps(true);
  }

  @action
  copyError() {
    this.toggleClipboardProps(false);
  }
}

Convert properties to tracked properties
CrateTomlCopy: Convert properties to tracked properties
