0.1.0 #1
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user