ServerInitializationExtension
on server.InitializationExtension
on client:@extension()
export class MyInitializationExtension extends InitializationExtension {
constructor(
@inject(IInitializationRepository$) private readonly _repository: IInitializationRepository
) {
super();
}
override async afterRequest(context: IInitializationExtensionContext): Promise<void> {
const additionalData = StorageHelper.tryGet(context.response?.tryGetInfo(), 'MyAdditionalData');
if (!additionalTiles) {
return;
}
await this._repository.setIfNotExists('MyAdditionalData', additionalData);
}
}
IInitializationRepository
:@extension()
export class MyCardUIExtension extends CardUIExtension {
constructor(
@inject(IInitializationRepository$) private readonly _repository: IInitializationRepository
) {
super();
}
override async initialized(context: ICardUIExtensionContext): Promise<void> {
const data = await this._repository.tryGet('MyAdditionalData');
// ...
}
}
Generated using TypeDoc