SerializationHelper

Class used to help serialization objects

Hierarchy

  • SerializationHelper

Index

Methods

Static Clone

Find examples in Playground
  • Clone<T>(creationFunction: function, source: T): T
  • Clones an object

    Type parameters

    • T

    Parameters

    • creationFunction: function

      defines the function used to instanciate the new object

        • (): T
        • Returns T

    • source: T

      defines the source object

    Returns T

    the cloned object

Static Instanciate

Find examples in Playground
  • Instanciate<T>(creationFunction: function, source: T): T
  • Instanciates a new object based on a source one (some data will be shared between both object)

    Type parameters

    • T

    Parameters

    • creationFunction: function

      defines the function used to instanciate the new object

        • (): T
        • Returns T

    • source: T

      defines the source object

    Returns T

    the new object

Static Parse

Find examples in Playground
  • Parse<T>(creationFunction: function, source: any, scene: Nullable<Scene>, rootUrl?: Nullable<string>): T
  • Creates a new entity from a serialization data object

    Type parameters

    • T

    Parameters

    • creationFunction: function

      defines a function used to instanciated the new entity

        • (): T
        • Returns T

    • source: any

      defines the source serialization data

    • scene: Nullable<Scene>

      defines the hosting scene

    • Optional rootUrl: Nullable<string>

      defines the root url for resources

    Returns T

    a new entity

Static Serialize

Find examples in Playground
  • Serialize<T>(entity: T, serializationObject?: any): any
  • Static function used to serialized a specific entity

    Type parameters

    • T

    Parameters

    • entity: T

      defines the entity to serialize

    • Optional serializationObject: any

      defines the optional target obecjt where serialization data will be stored

    Returns any

    a JSON compatible object representing the serialization of the entity

Generated using TypeDoc