TWSSnippet

constructor(id: String, target: String, headers: Map<String, String> = emptyMap(), dynamicResources: List<TWSAttachment> = emptyList(), props: Map<String, Any> = emptyMap(), engine: TWSEngine = TWSEngine.NONE, loadIteration: Int = 0)

Parameters

id

A unique identifier for the snippet.

target

The URL of the snippets content.

headers

custom HTTP headers to include with the request.

dynamicResources

A list of resources (CSS/JS) to inject.

props

Custom properties for the snippet. These properties can be used for a variety of purposes, such as displaying a snippet's title, sorting snippets by a sort key, or providing additional metadata for snippet handling. If the engine is set to TWSEngine.MUSTACHE, all provided properties are also used for Mustache template processing while displaying snippet in TWSView.

engine

Specifies how the snippet content is processed.

loadIteration

A counter to manually trigger a redraw of the snippet in TWSView. Useful when the HTML content changes but the snippet itself remains unchanged. Incrementing this forces TWSView to redraw and reflect the updated HTML.