TWSSnippet

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

Represents a web snippet that can be rendered in a TWSView.

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.

Constructors

Link copied to clipboard
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)

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val id: String
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard