Skip to content

API reference > @kontsedal/olas-core > defineScope

defineScope() function ​

Create a scope. The returned value is the typed handle passed toctx.provide(scope, value) and ctx.inject(scope). The scope object is its own identity, so two defineScope() calls — even with identical options — yield distinct scopes.

Signature:

typescript
declare function defineScope<T>(options?: ScopeOptions<T>): Scope<T>;

Parameters ​

Parameter

Type

Description

options

ScopeOptions<T>

(Optional)

Returns:

Scope<T>

Released under the MIT License.