Provide a Context
Providing a Context enables distant code to communicate with it, ideal way to incorporate central logic.
Provide a Context API
import { UmbContextBase } from '@umbraco-cms/backoffice/class-api';
export class MyCustomContext extends UmbContextBase {
constructor(host: UmbControllerHost) {
super(host, MY_CUSTOM_CONTEXT);
}
}
export const MY_CUSTOM_CONTEXT = new UmbContextToken<MyCustomContext, MyCustomContext>(
'MyCustomContextUniqueAlias',
);this.provideContext('myContextAlias', new MyContextApi());new UmbContextProviderController(host, 'myContextAlias', new MyContextApi());Last updated
Was this helpful?