github.com/hernad/nomad@v1.6.112/ui/app/components/breadcrumb.js (about)

     1  /**
     2   * Copyright (c) HashiCorp, Inc.
     3   * SPDX-License-Identifier: MPL-2.0
     4   */
     5  
     6  import { assert } from '@ember/debug';
     7  import { action } from '@ember/object';
     8  import { inject as service } from '@ember/service';
     9  import Component from '@glimmer/component';
    10  
    11  export default class Breadcrumb extends Component {
    12    @service breadcrumbs;
    13  
    14    constructor() {
    15      super(...arguments);
    16      assert('Provide a valid breadcrumb argument', this.args.crumb);
    17      this.register();
    18    }
    19  
    20    @action register() {
    21      this.breadcrumbs.registerBreadcrumb(this);
    22    }
    23  
    24    @action deregister() {
    25      this.breadcrumbs.deregisterBreadcrumb(this);
    26    }
    27  
    28    willDestroy() {
    29      super.willDestroy();
    30      this.deregister();
    31    }
    32  }