Skip to content
Bunshi
GitHub

MoleculeScope

MoleculeScope: <T> { defaultTuple: ScopeTuple< T >; defaultValue: T; displayName: string; } & Record< symbol, unknown >

A scope that can be used to create scoped molecules.

When a molecule depends on a scope, this it becomes a scoped molecule and the molecule will be called to provide a value once per unique scope value.

Create a MoleculeScope by calling createScope

export const UserScope = createScope("user1")

MoleculeScope.defaultTuple

defaultTuple: ScopeTuple< T >

MoleculeScope.defaultValue

defaultValue: T

MoleculeScope.displayName

displayName?: string

Type parameters

Parameter
T

Source

scope.ts:16