survey-creator icon indicating copy to clipboard operation
survey-creator copied to clipboard

ICreatorPlugin refactoring

Open tsv2013 opened this issue 1 year ago • 0 comments

It seems to me that these methods

  canDeactivateAsync?: (onSuccess: () => void) => void;
  defaultAllowingDeactivate?: () => boolean | undefined;
  onDesignerSurveyPropertyChanged?: (obj: Base, propName: string) => void;

methods shouldn't be in this interface:

export interface ICreatorPlugin {
  activate: () => void;
  update?: () => void;
  deactivate?: () => boolean;
  canDeactivateAsync?: (onSuccess: () => void) => void;
  defaultAllowingDeactivate?: () => boolean | undefined;
  dispose?: () => void;
  onDesignerSurveyPropertyChanged?: (obj: Base, propName: string) => void;
  model: Base;
}

We need to apply Interface Segregation Principle here, or combine these methods with the existing ones: canDeactivateAsync and defaultAllowingDeactivate functionality probably can be included in the deactivate method.

tsv2013 avatar Jan 26 '24 07:01 tsv2013