Skip to main content
Version: 1.0.0

Scopes and context

This reference documents every current public declaration in this part of Pine. Examples run inside App.Mount(), a component factory, or an explicit P.Root(...) unless they only create state/configuration. Explicit P.Mount(...) remains available for advanced ownership. Variable names such as count, items and label refer to the typed values described by each example. All APIs run on Unity’s main thread.

Scope​

Scope

A lifetime container for reactive observers, callbacks and native resources.

Scope.IsDisposed​

bool IsDisposed

Reports whether cleanup has begun/completed for this scope.

Scope.Run​

public void Run(Action action)

Temporarily enters this live scope, preserving ownership and scoped context, and restores the previous scope afterward.

public T Run<T>(Func<T> action)

Temporarily enters this live scope, preserving ownership and scoped context, and restores the previous scope afterward.

Scope.Own​

public T Own<T>(T resource)
where T : IDisposable

Registers an IDisposable for reverse-order cleanup and returns the same resource.

Scope.Dispose​

public void Dispose()

Ends this owned lifetime idempotently.

Context​

Context<T>

A scoped typed dependency with a fallback outside providers.

Context.Value​

T Value

Returns the nearest scoped provider value or the configured fallback.

Context.Provide​

public void Provide(T value, Action build)

Constructs a parent-owned provider scope with this typed value.

public TResult Provide<TResult>(T value, Func<TResult> build)

Constructs a parent-owned provider scope with this typed value.