Skip to main content

register

@quik/entity


@quik/entity / EntityStore / register

Function: register()

register(...entities): void

Defined in: entity/src/store.ts:175

Register one or more entity constructors with the store.

This function adds entity classes to the internal registry by:

  1. Validating that each constructor has the required 'Entity' property
  2. Extracting the entity name and using it as the registry key
  3. Making the entity available for later retrieval and instantiation

Parameters

entities

...Constructor<QEntity>[]

Entity constructors to register

Returns

void

Example

// Register a single entity
EntityStore.register(UserEntity);

// Register multiple entities at once
EntityStore.register(UserEntity, ProductEntity, OrderEntity);

// After registration, entities can be retrieved and instantiated
const User = EntityStore.get('User');
const newUser = new User();

See

  • get For retrieving registered entities
  • create For instantiating registered entities