feat(hp): add onStageChange callback (#5165)

This commit is contained in:
Ibrahim 2025-06-27 13:08:21 -04:00 committed by GitHub
parent c2b75e1a50
commit 4bddd53fcd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 0 deletions

View File

@ -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);

View File

@ -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[];
};
/**