open-nomad/ui/app/components/breadcrumb.js

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

33 lines
694 B
JavaScript
Raw Normal View History

/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: MPL-2.0
*/
import { assert } from '@ember/debug';
import { action } from '@ember/object';
import { inject as service } from '@ember/service';
import Component from '@glimmer/component';
export default class Breadcrumb extends Component {
@service breadcrumbs;
constructor() {
super(...arguments);
assert('Provide a valid breadcrumb argument', this.args.crumb);
this.register();
}
@action register() {
this.breadcrumbs.registerBreadcrumb(this);
}
@action deregister() {
this.breadcrumbs.deregisterBreadcrumb(this);
}
willDestroy() {
super.willDestroy();
this.deregister();
}
}