From 4bddd53fcdf24cf861e73b8be705bc7e12afee56 Mon Sep 17 00:00:00 2001 From: Ibrahim <93064150+IbrahimCSAE@users.noreply.github.com> Date: Fri, 27 Jun 2025 13:08:21 -0400 Subject: [PATCH] feat(hp): add onStageChange callback (#5165) --- .../HangingProtocolService/HangingProtocolService.ts | 5 +++++ platform/core/src/types/HangingProtocol.ts | 2 ++ 2 files changed, 7 insertions(+) diff --git a/platform/core/src/services/HangingProtocolService/HangingProtocolService.ts b/platform/core/src/services/HangingProtocolService/HangingProtocolService.ts index 52cb1e0ed..fd85749ac 100644 --- a/platform/core/src/services/HangingProtocolService/HangingProtocolService.ts +++ b/platform/core/src/services/HangingProtocolService/HangingProtocolService.ts @@ -1064,6 +1064,11 @@ export default class HangingProtocolService extends PubSubService { throw new Error(`Can't find applicable stage ${protocol.id} ${options?.stageIndex}`); } this.stageIndex = stage as number; + + if (this.protocol?.callbacks?.onStageChange) { + this._commandsManager.run(this.protocol.callbacks.onStageChange); + } + this._updateViewports(options); } catch (error) { console.log(error); diff --git a/platform/core/src/types/HangingProtocol.ts b/platform/core/src/types/HangingProtocol.ts index b20ecfad3..189fe0dcc 100644 --- a/platform/core/src/types/HangingProtocol.ts +++ b/platform/core/src/types/HangingProtocol.ts @@ -293,6 +293,8 @@ export type ProtocolNotifications = { // and all viewport data includes a designated display set. This command // will run on every stage's initial layout. onViewportDataInitialized?: Command[]; + // This set of commands is executed before the stage change is applied + onStageChange?: Command[]; }; /**