Skip to main content

@cardsgame/client

Classes

Interfaces

Type Aliases

ArraySchemaDefinition

Ƭ ArraySchemaDefinition: ArrayOfPrimitivesDefinition | ArrayOfSchemaObjectsDefinition


ClientGameState

Ƭ ClientGameState<MoreProps>: ObjectSchema<ClientGameStateProps & MoreProps> & EntityParentNode

Type parameters

NameType
MorePropsRecord<string, any>

ClientGameStateProps

Ƭ ClientGameStateProps: Object

Root game state

Type declaration

NameType
clientsGameClientDefinition[]
currentPlayerIdx?number
isGameOverboolean
isGameStartedboolean
playerViewPositionIPlayerViewPosition
playersPlayerDefinition[]
roundnumber
tableHeightnumber
tableWidthnumber
turnBasedboolean
ui?Map<string, string>

CollectionCallback

Ƭ CollectionCallback<T, K>: (instance: T, key: K) => void

Type parameters

NameType
TT
Kstring

Type declaration

▸ (instance, key): void

Parameters
NameType
instanceT
keyK
Returns

void


MapSchemaDefinition

Ƭ MapSchemaDefinition: MapOfPrimitivesDefinition | MapOfSchemaObjectsDefinition


ObjectSchema

Ƭ ObjectSchema<T>: ObjectSchemaColyBase<T> & DirectPrimitiveOrSchemaObject<T> & WithSchemaDefinition

Type parameters

NameType
TRecord<string, any>

PrimitiveValue

Ƭ PrimitiveValue: string | boolean | number


Schema

Ƭ Schema<T, K>: ObjectSchema<T> | ObjectsCollectionSchema<T, K> | PrimitivesCollectionSchema<T, K>

Base for all fields in State in each schema.

Type parameters

NameType
Tany
Kany

SchemaChangeCallback

Ƭ SchemaChangeCallback: (changes: DataChange[]) => void

Type declaration

▸ (changes): void

Parameters
NameType
changesDataChange[]
Returns

void


SchemaDefinitionFieldTypes

Ƭ SchemaDefinitionFieldTypes: Record<string, SchemaDefinitionValue>


SchemaDefinitionValue

Ƭ SchemaDefinitionValue: string | ArraySchemaDefinition | MapSchemaDefinition | WithSchemaDefinition

Functions

isDefinitionOfArraySchema

isDefinitionOfArraySchema(o): o is ArraySchemaDefinition

Parameters

NameType
ounknown

Returns

o is ArraySchemaDefinition


isDefinitionOfMapSchema

isDefinitionOfMapSchema(o): o is MapSchemaDefinition

Parameters

NameType
ounknown

Returns

o is MapSchemaDefinition


isDefinitionOfObjectsCollection

isDefinitionOfObjectsCollection(o): o is CollectionOfObjectsDefinition

Parameters

NameType
ounknown

Returns

o is CollectionOfObjectsDefinition


isDefinitionOfPrimitive

isDefinitionOfPrimitive(o): o is string

Parameters

NameType
ounknown

Returns

o is string


isDefinitionOfPrimitivesCollection

isDefinitionOfPrimitivesCollection(o): o is CollectionOfPrimitivesDefinition

Parameters

NameType
ounknown

Returns

o is CollectionOfPrimitivesDefinition


isDefinitionOfSchema

isDefinitionOfSchema(o): o is WithSchemaDefinition

Parameters

NameType
ounknown

Returns

o is WithSchemaDefinition


isSchemaDefinition

isSchemaDefinition(o): o is SchemaDefinition

Parameters

NameType
ounknown

Returns

o is SchemaDefinition


isSchemaObject

isSchemaObject(o): o is Schema<any, any>

Parameters

NameType
ounknown

Returns

o is Schema<any, any>


isSchemaParent

isSchemaParent(schema): boolean

Is given object a schema of entities container

Parameters

NameType
schemaObjectSchema

Returns

boolean


makeChildrenCollection

makeChildrenCollection(schema): ChildrenDecorator

Creates new schema-like object containing all child entities in a Map. You can subscribe to onAdd and onRemove the same way as with any other collections.

Parameters

NameTypeDescription
schemaSchemaschema object of all child entities in given container entity

Returns

ChildrenDecorator