mirror of
https://github.com/barsdeveloper/ueblueprint.git
synced 2026-02-04 08:08:18 +08:00
* WIP * Fix type 1 * Missing types info * Some fixes * Several types refactoring and fixes * WIP * Fix grammar
23 lines
564 B
JavaScript
Executable File
23 lines
564 B
JavaScript
Executable File
export default class SerializerFactory {
|
|
|
|
static #serializers = new Map()
|
|
|
|
/**
|
|
* @template {SimpleValueType<SimpleValue>} T
|
|
* @param {T} type
|
|
* @param {Serializer<T>} object
|
|
*/
|
|
static registerSerializer(type, object) {
|
|
SerializerFactory.#serializers.set(type, object)
|
|
}
|
|
|
|
/**
|
|
* @template {SimpleValueType<any>} T
|
|
* @param {T} type
|
|
* @returns {Serializer<ConstructedType<T>>}
|
|
*/
|
|
static getSerializer(type) {
|
|
return SerializerFactory.#serializers.get(type)
|
|
}
|
|
}
|