Utility to serialize a model object (and its children) continuously and efficiently

Events

@:dox(show)changeset(changeset:SerializeChangeset):Void

Triggered when serialized data is updated. If append is true, the given string should be appended to the existing one.

Static methods

@:value({ hotReload : false })staticloadFromData(model:Model, data:String, hotReload:Bool = false):Bool

Constructor

new()

Available on clay

Variables

@:value(1.0)checkInterval:Float = 1.0

@:value(60.0)compactInterval:Float = 60.0

@:value(true)destroyModelOnUntrack:Bool = true

@:value(new Map())read onlyserializedMap:Map<String, {type:String, props:Dynamic, id:String}> = new Map()

read onlymodel:Model

@:value(null)read onlyinitializerName:String = null

Methods

compact(?done:String ‑> Void):Void

Recompute the whole object tree instead of appending. This will untrack every object not on the model anymore and generate a new changeset with the whole serialized object tree.

synchronize():Void

Synchronize (expected to be called at regular intervals or when something important needs to be serialized)

Inherited Events

Defined by Entity

@:dox(show)dispose(entity:Entity):Void

@:dox(show)destroy(entity:Entity):Void

Inherited Variables

Defined by Entity

read onlyhasData:Bool

@:value(null)id:String = null

read onlydestroyed:Bool

read onlydisposed:Bool

@:value(null)read onlyautoruns:Array<Autorun> = null

@editablecomponents:ReadOnlyMap<String, Component>

Public components mapping. Contain components created separately with component() or macro-based components as well.

scriptContent:ScriptContent

Available with script plugin

script:Script

Available with script plugin

Inherited Methods

Defined by Entity

destroy():Void

Destroy this entity. This method is automatically protected from duplicate calls. That means calling multiple times an entity's destroy() method will run the destroy code only one time. As soon as destroy() is called, the entity is marked destroyed=true, even when calling destroy() method on a subclass (a macro is inserting a code to mark the object as destroyed at the beginning of every destroy() override function.

dispose():Void

Schedules destroy, at the end of the current frame.

unbindEvents():Void

Remove all events handlers from this entity.

autorun(run:() ‑> Void, ?afterRun:() ‑> Void):Autorun

Creates a new Autorun instance with the given callback associated with the current entity.

Parameters:

run

The run callback

Returns:

The autorun instance

tween(?easing:Easing, duration:Float, fromValue:Float, toValue:Float, update:(Float, Float) ‑> Void):Tween

component<C>(?name:String, ?component:Null<C>):C