Scope

value class Scope(entries: HashMap<Scope.Key<*>, Any> = hashMapOf())

Contains any type of data which consists of a Key and a corresponding value object.

Constructors

Link copied to clipboard
constructor(parent: Scope)

Creates a new Scope instance from a given one.

constructor(entries: HashMap<Scope.Key<*>, Any> = hashMapOf())

Types

Link copied to clipboard
object Companion
Link copied to clipboard
open class Key<T : Any>(val name: String)

Key for setting and receiving entries in the Scope

Properties

Link copied to clipboard
val keys: Set<Scope.Key<*>>

Returns all containing Keys from the Scope.

Link copied to clipboard
val size: Int

Gives the number of stored key-value-pairs.

Functions

Link copied to clipboard
fun <T : Any> contains(key: Scope.Key<T>): Boolean

Checks if the Scope contains the given key.

Link copied to clipboard
operator fun <T : Any> get(key: Scope.Key<T>): T?

Receives a key-value-par from the Scope.

Link copied to clipboard
operator fun iterator(): Iterator<Map.Entry<Scope.Key<*>, Any>>

Returns an Iterator over the entries in the Scope.

Link copied to clipboard
operator fun Scope.plus(scope: ScopeContext.() -> Unit): ScopeContext.() -> Unit
Link copied to clipboard
fun <T : Any> remove(key: Scope.Key<T>): Any?

Removes the specified key and its corresponding value from the Scope.

Link copied to clipboard
open override fun toString(): String

Formats the Scope to a valid JSON string for printing or using it inside Javascript.