Serializer
Index
Constructors
Methods
- actorFromJSON
- actorToJSON
- clearComponents
- clearCustomActors
- clearGraphics
- deserializeActor
- deserializeComponent
- deserializeEntity
- entityFromJSON
- entityToJSON
- getCustomActor
- getCustomSerializer
- getGraphic
- getRegisteredComponents
- getRegisteredCustomActors
- getRegisteredGraphics
- getRegistry
- init
- isComponentRegistered
- isCustomActorRegistered
- isGraphicRegistered
- isInitialized
- registerComponent
- registerComponents
- registerCustomActor
- registerCustomActors
- registerCustomSerializer
- registerGraphic
- registerGraphics
- reset
- serializeActor
- serializeComponent
- serializeEntity
- unregisterComponent
- unregisterCustomActor
- unregisterGraphic
- validateEntityData
Constructors
constructor
Returns Serializer
Methods
staticactorFromJSON
Parameters
json: string
Returns Actor | null
staticactorToJSON
Parameters
actor: Actor
pretty: boolean = false
Returns string
staticclearComponents
Clear all registered components
Returns void
staticclearCustomActors
Returns void
staticclearGraphics
Clear all registered graphics
Returns void
staticdeserializeActor
Parameters
data: EntityData
Returns Actor | null
staticdeserializeComponent
Deserialize a component
Parameters
data: ComponentData
Returns Component | null
staticdeserializeEntity
Parameters
data: EntityData
Returns Entity<any> | null
staticentityFromJSON
Deserialize entity from JSON string
Parameters
json: string
Returns Entity<any> | null
staticentityToJSON
Serialize entity to JSON string
Parameters
entity: Entity
pretty: boolean = false
Returns string
staticgetCustomActor
Parameters
typeName: string
Returns typeof Actor | null
staticgetCustomSerializer
Parameters
typeName: string
Returns { deserialize: (data: any) => any; serialize: (obj: any) => any } | undefined
staticgetGraphic
Parameters
id: string
Returns any
staticgetRegisteredComponents
Get all registered component types
Returns string[]
staticgetRegisteredCustomActors
Returns string[]
staticgetRegisteredGraphics
Get all registered graphic IDs
Returns string[]
staticgetRegistry
Parameters
registry: components | graphics | actors
Returns Map<string, any>
staticinit
Parameters
autoRegisterComponents: boolean = true
Returns void
staticisComponentRegistered
Check if a component type is registered
Parameters
typeName: string
Returns boolean
staticisCustomActorRegistered
Parameters
typeName: string
Returns boolean
staticisGraphicRegistered
Check if a graphic is registered
Parameters
id: string
Returns boolean
staticisInitialized
Returns boolean
staticregisterComponent
Type parameters
- T: Component
Parameters
ctor: ComponentCtor<T>
Returns void
staticregisterComponents
Parameters
ctors: ComponentCtor[]
Returns void
staticregisterCustomActor
Parameters
ctor: typeof Actor
Returns void
staticregisterCustomActors
Parameters
ctors: typeof Actor[]
Returns void
staticregisterCustomSerializer
Register a custom serializer for a specific type Useful for types like Vector, Color, BoundingBox, etc.
Parameters
typeName: string
serialize: (obj: any) => any
deserialize: (data: any) => any
Returns void
staticregisterGraphic
Parameters
id: string
graphic: any
Returns void
staticregisterGraphics
Parameters
graphics: Record<string, any>
Returns void
staticreset
Reset all registrations (useful for testing)
Returns void
staticserializeActor
Parameters
actor: Actor
Returns EntityData
staticserializeComponent
Serialize a component
Parameters
component: Component
Returns ComponentData | null
staticserializeEntity
Parameters
entity: Entity
Returns EntityData
staticunregisterComponent
Unregister a component type
Parameters
typeName: string
Returns boolean
staticunregisterCustomActor
Parameters
typeName: string
Returns boolean
staticunregisterGraphic
Unregister a graphic
Parameters
id: string
Returns boolean
staticvalidateEntityData
Validate entity data structure
Parameters
data: any
Returns data is EntityData
Central serialization system for ExcaliburJS Handles all serialization/deserialization with extensible registry