DisposableStack

Constructors

Link copied to clipboard
constructor()

Properties

Link copied to clipboard

Returns a value indicating whether this stack has been disposed.

Functions

Link copied to clipboard
fun <T : JsAny?> adopt(value: T, onDispose: (value: T) -> Unit): T

Adds a value and associated disposal callback as a resource to the stack.

Link copied to clipboard
fun defer(onDispose: () -> Unit)

Adds a callback to be invoked when the stack is disposed.

Link copied to clipboard
fun dispose()

Disposes each resource in the stack in the reverse order that they were added.

Link copied to clipboard
open operator fun get(key: Symbol.dispose): Dispose
Link copied to clipboard

Move all resources out of this stack and into a new DisposableStack, and marks this stack as disposed.

Link copied to clipboard
fun <T : Disposable?> use(value: T): T

Adds a disposable resource to the stack, returning the resource.