* add eslint rule to enforce element suffix on elements * remove fixer * rename first round of elements * add element to element class name * add element suffix * rename element * add element to UmbControllerHost instead of interface * update imports after merge * remove fixable flag * fix after merge
30 lines
789 B
TypeScript
30 lines
789 B
TypeScript
import { UmbContextToken } from '../token/context-token';
|
|
import { UmbContextConsumer } from './context-consumer';
|
|
import { UmbContextCallback } from './context-request.event';
|
|
import type { UmbControllerHostElement, UmbControllerInterface } from '@umbraco-cms/backoffice/controller';
|
|
|
|
export class UmbContextConsumerController<T = unknown>
|
|
extends UmbContextConsumer<UmbControllerHostElement, T>
|
|
implements UmbControllerInterface
|
|
{
|
|
public get unique() {
|
|
return undefined;
|
|
}
|
|
|
|
constructor(
|
|
host: UmbControllerHostElement,
|
|
contextAlias: string | UmbContextToken<T>,
|
|
callback: UmbContextCallback<T>
|
|
) {
|
|
super(host, contextAlias, callback);
|
|
host.addController(this);
|
|
}
|
|
|
|
public destroy() {
|
|
super.destroy();
|
|
if (this.host) {
|
|
this.host.removeController(this);
|
|
}
|
|
}
|
|
}
|