2021-11-30 20:21:56 +00:00
|
|
|
import Service from '@ember/service';
|
|
|
|
import { action } from '@ember/object';
|
|
|
|
import { tracked } from '@glimmer/tracking';
|
|
|
|
import { schedule } from '@ember/runloop';
|
2018-06-20 01:07:09 +00:00
|
|
|
|
2021-11-30 20:21:56 +00:00
|
|
|
export default class BucketService extends Service {
|
|
|
|
@tracked crumbs = [];
|
2018-06-20 01:07:09 +00:00
|
|
|
|
2021-11-30 20:21:56 +00:00
|
|
|
@action registerBreadcrumb(crumb) {
|
|
|
|
schedule('actions', this, () => {
|
|
|
|
console.log('register crumb: ', crumb);
|
|
|
|
this.crumbs = [...this.crumbs, crumb];
|
2018-06-20 01:07:09 +00:00
|
|
|
});
|
2021-11-30 20:21:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@action deregisterBreadcrumb(crumb) {
|
|
|
|
const newCrumbs = this.crumbs.filter(c => c !== crumb);
|
2018-06-20 01:07:09 +00:00
|
|
|
|
2021-11-30 20:21:56 +00:00
|
|
|
this.crumbs = newCrumbs;
|
2020-06-10 13:49:16 +00:00
|
|
|
}
|
|
|
|
}
|