Skip to content

textmode.js / Textmodifier / loadTileset

Method: loadTileset()

ts
loadTileset(tilesetSource, setActive?): Promise<TextmodeTileset>;

Load a tileset and optionally set it as the base layer's active glyph source.

Accepts either tileset load options or an existing TextmodeTileset instance to use as a reusable source.

If setActive is true (default), the tileset is set as the base layer's glyph source. If setActive is false, the tileset is loaded/initialized and returned without modifying the layer.

The returned tileset can be reused on other layers via TextmodeLayer.loadTileset, which creates a layer-local fork rather than sharing a mutable instance by reference.

Parameters

ParameterTypeDefault valueDescription
tilesetSource| TextmodeTilesetOptions | TextmodeTilesetundefinedTileset options or reusable TextmodeTileset instance.
setActivebooleantrueWhether to activate the tileset on the base layer. Defaults to true.

Returns

Promise<TextmodeTileset>

The loaded TextmodeTileset.

Example