0.1.0 #1

Merged
Thilawyn merged 87 commits from next into master 2025-01-18 00:54:42 +01:00
Showing only changes of commit 2aaee4826b - Show all commits

View File

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