LensStudio:Serialization.IWriter
ClassInterface for writing serializable data.
Index
Example
// IWriter serializes data to a string. Obtain one via Yaml.createWriter()
// (the constructor is protected). The resulting writer can be passed to
// APIs that persist state — for example, Editor.Dock.IDockManager.write()
// dumps the current dock layout and panel identifiers into the writer.
const { Yaml } = await import('LensStudio:Serialization');
const writer = Yaml.createWriter();
// Serialize the current dock layout (panel IDs + attached/detached state)
// through the IDockManager interface. This writes scene object-style
// properties into the writer.
const dockManager = this.pluginSystem.findInterface(
Editor.Dock.IDockManager.interfaceId
) as unknown as Editor.Dock.IDockManager;
if (!Editor.isNull(dockManager)) {
dockManager.write(writer);
}
// getString() returns the YAML output — a structured, JSON-like string
// describing every panel and its dock state. It can be round-tripped
// through Yaml.createReader() and IDockManager.read() to restore layout.
const serialized = writer.getString();
console.log('IWriter produced', serialized.length, 'bytes of YAML');
console.log(serialized);
Extends
Methods
getString()
getString():
string
Get the serialized output as a string.
Returns
string
getTypeName()
staticgetTypeName():string
Returns the type name of this class.
Returns
string
Overrides
getTypeName()
getTypeName():
string
Returns the name of this object's type.
Returns
string
Inherited from
isOfType()
isOfType(
type):boolean
Returns true if the object is of the specified type.
Parameters
| Parameter | Type |
|---|---|
type | string |
Returns
boolean
Inherited from
isSame()
isSame(
other):boolean
Returns true if this object refers to the same instance as the given object.
Parameters
| Parameter | Type |
|---|---|
other | ScriptObject |
Returns
boolean