@eclipse-emfcloud/model-validation
Version:
Generic model validation framework.
33 lines • 1.32 kB
TypeScript
import { Diagnostic } from './diagnostic';
/**
* Call-back signature for notification of updates to the validation state
* of models.
*
* @template K the type of model identifier in the validation service
* @template M the type of model object that is validated
*
* @param modelId the unique identifier of the model that was validated
* @param model the model that was validated
* @param diagnostic the validation state that was computed or updated for the model
*/
export type ValidationListener<K, M extends object = object> = (modelId: K, model: M, diagnostic: Diagnostic) => void;
/**
* Interface of an object that provides notification of updates to the
* validation state of models.
*
* @template K the type of model identifier in the validation service
* @template M the type of model object that is validated
*/
export interface ValidationSubscription<K, M extends object = object> {
/**
* The call-back function to invoke on notification of validation state.
*/
onValidationChanged?: ValidationListener<K, M>;
/**
* Terminate the subscription. After the subscription is closed,
* the {@link onValidationChanged} call-back will not be invoked
* for any future validation updates.
*/
close(): void;
}
//# sourceMappingURL=validation-subscription.d.ts.map