0.1.11 #14

Merged
Thilawyn merged 318 commits from next into master 2025-05-19 14:01:41 +02:00
Showing only changes of commit c8b675d93e - Show all commits

View File

@@ -30,7 +30,7 @@ export abstract class ReffuseNamespace<R> {
this.SubRef = this.SubRef.bind(this as any) as any this.SubRef = this.SubRef.bind(this as any) as any
this.SubscribeRefs = this.SubscribeRefs.bind(this as any) as any this.SubscribeRefs = this.SubscribeRefs.bind(this as any) as any
this.RefState = this.RefState.bind(this as any) as any this.RefState = this.RefState.bind(this as any) as any
// this.SubscribeStream = this.SubscribeStream.bind(this as any) as any this.SubscribeStream = this.SubscribeStream.bind(this as any) as any
} }
@@ -592,16 +592,31 @@ export abstract class ReffuseNamespace<R> {
return props.children(this.useRefState(props.ref)) return props.children(this.useRefState(props.ref))
} }
// SubscribeStream<A, E, R, InitialA extends A = never, InitialE = never>( SubscribeStream<A, E, R>(
// this: ReffuseNamespace<R>, this: ReffuseNamespace<R>,
// props: { props: {
// readonly stream: Stream.Stream<A, E, R> readonly stream: Stream.Stream<A, E, R>
// readonly initialValue?: () => Effect.Effect<InitialA, InitialE, R> readonly children: (latestValue: Option.Option<A>) => React.ReactNode
// readonly children: (latestValue: InitialA extends A ? Option.Some<A> : Option.Option<A>) => React.ReactNode },
// }, ): React.ReactNode
// ): React.ReactNode { SubscribeStream<A, E, IE, R>(
// return props.children(this.useSubscribeStream(props.stream, props.initialValue)) this: ReffuseNamespace<R>,
// } props: {
readonly stream: Stream.Stream<A, E, R>
readonly initialValue: () => Effect.Effect<A, IE, R>
readonly children: (latestValue: Option.Some<A>) => React.ReactNode
},
): React.ReactNode
SubscribeStream<A, E, IE, R>(
this: ReffuseNamespace<R>,
props: {
readonly stream: Stream.Stream<A, E, R>
readonly initialValue?: () => Effect.Effect<A, IE, R>
readonly children: (latestValue: Option.Some<A>) => React.ReactNode
},
): React.ReactNode {
return props.children(this.useSubscribeStream(props.stream, props.initialValue as () => Effect.Effect<A, IE, R>))
}
} }