extend
Some checks failed
Lint / lint (push) Failing after 9s

This commit is contained in:
Julien Valverdé
2025-01-14 15:53:20 +01:00
parent f50adbf119
commit 2aaee4826b

View File

@@ -14,7 +14,7 @@ export class Reffuse<
readonly Provider: ReffuseReactContext.Provider<RuntimeR, OwnContextR, ParentContextR>
constructor(
runtime: Runtime.Runtime<RuntimeR>,
readonly runtime: Runtime.Runtime<RuntimeR>,
parent?: Reffuse<RuntimeR, ParentContextR, unknown, unknown>,
) {
this.Provider = parent
@@ -22,6 +22,15 @@ export class Reffuse<
: ReffuseReactContext.makeRootProvider(runtime, this.Context)
}
extend<OwnContextR = never>() {
return new Reffuse<
RuntimeR,
ContextR | OwnContextR,
OwnContextR,
ContextR
>(this.runtime, this)
}
useRuntime(): Runtime.Runtime<RuntimeR> {
return React.useContext(this.Context).runtime