2021-12-15 16:56:26 +00:00
|
|
|
import { assert } from '@ember/debug';
|
2021-11-30 20:10:01 +00:00
|
|
|
import { action } from '@ember/object';
|
|
|
|
import { inject as service } from '@ember/service';
|
2021-12-15 16:56:26 +00:00
|
|
|
import Component from '@glimmer/component';
|
2021-11-30 20:10:01 +00:00
|
|
|
|
|
|
|
export default class Breadcrumb extends Component {
|
2021-11-30 20:21:56 +00:00
|
|
|
@service breadcrumbs;
|
2021-11-30 20:10:01 +00:00
|
|
|
|
2021-12-15 16:56:26 +00:00
|
|
|
constructor() {
|
|
|
|
super(...arguments);
|
|
|
|
assert('Provide a valid breadcrumb argument', this.args.crumb);
|
|
|
|
this.register();
|
|
|
|
}
|
|
|
|
|
2021-11-30 20:10:01 +00:00
|
|
|
@action register() {
|
2021-11-30 20:21:56 +00:00
|
|
|
this.breadcrumbs.registerBreadcrumb(this);
|
2021-11-30 20:10:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@action deregister() {
|
2021-11-30 20:21:56 +00:00
|
|
|
this.breadcrumbs.deregisterBreadcrumb(this);
|
2021-11-30 20:10:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
willDestroy() {
|
|
|
|
super.willDestroy();
|
|
|
|
this.deregister();
|
|
|
|
}
|
|
|
|
}
|