Перейти к основному содержимому

AbstractRegistry

Defined in: core/utils/abstract-registry.ts:56

Базовый класс для реестров (BehaviorRegistry, ValidationRegistry).

Реализует паттерн Template Method для управления регистрацией: beginRegistration()onBeginRegistration(), endRegistration()onEndRegistration().

Example

import { AbstractRegistry } from '@reformer/core';

class MyRegistry extends AbstractRegistry<{ name: string }> {
protected onEndRegistration(items: { name: string }[]) {
console.log('Registered', items.length);
}
}

Extended by

Type Parameters

TRegistration

TRegistration

Тип регистрируемых элементов.

Constructors

Constructor

new AbstractRegistry<TRegistration>(): AbstractRegistry<TRegistration>;

Returns

AbstractRegistry<TRegistration>

Methods

beginRegistration()

beginRegistration(): void;

Defined in: core/utils/abstract-registry.ts:102

Начать регистрацию

Помещает this в global stack для изоляции форм Вызывает hook onBeginRegistration()

Returns

void


cancelRegistration()

cancelRegistration(registryName): void;

Defined in: core/utils/abstract-registry.ts:153

Отменить регистрацию без применения

Parameters

registryName

string

Имя реестра для отладки

Returns

void


completeRegistration()

protected completeRegistration(registryName): void;

Defined in: core/utils/abstract-registry.ts:140

Завершить регистрацию и извлечь из стека

Parameters

registryName

string

Имя реестра для отладки

Returns

void


getCurrentFromStack()

protected static getCurrentFromStack<T>(ctor): T | null;

Defined in: core/utils/abstract-registry.ts:89

Получить текущий активный реестр из стека Должен быть переопределен в наследниках как static метод

Type Parameters

T

T extends AbstractRegistry<any>

Parameters

ctor

(...args) => T

Конструктор класса реестра

Returns

T | null

Текущий активный реестр или null


getRegistrations()

getRegistrations(): TRegistration[];

Defined in: core/utils/abstract-registry.ts:123

Получить зарегистрированные элементы

Returns

TRegistration[]


getStack()

protected static getStack<T>(ctor): RegistryStack<T>;

Defined in: core/utils/abstract-registry.ts:71

Получить стек для конкретного класса реестра Создает новый стек если не существует

Type Parameters

T

T extends AbstractRegistry<any>

Parameters

ctor

(...args) => T

Конструктор класса реестра

Returns

RegistryStack<T>

RegistryStack для данного класса


isActive()

isActive(): boolean;

Defined in: core/utils/abstract-registry.ts:116

Проверить, активна ли регистрация

Returns

boolean


onBeginRegistration()

protected onBeginRegistration(): void;

Defined in: core/utils/abstract-registry.ts:131

Hook: вызывается в начале регистрации Может быть переопределен в наследниках для инициализации

Returns

void

Properties

isRegistering

protected isRegistering: boolean = false;

Defined in: core/utils/abstract-registry.ts:58

Флаг активной регистрации


registrations

protected registrations: TRegistration[] = [];

Defined in: core/utils/abstract-registry.ts:61

Массив зарегистрированных элементов