Skip to content

Add Behavior type #223

@raveclassic

Description

@raveclassic

Add the following type to rx-utils

interface Behavior<A> extends Observable<A> {
  readonly getValue: () => A;
}

so that we could use it as both a value-over-time and an Observable.

Also add typeclass instance (you can use rxjs's internal _subscribe method to deal with Observable#subscribe which cannot be overridden due to messy overloadings):

export const instance: Functor<URI> & FoldableValue<URI>  = { ... } 
export const behavior = {
  ...instance,
  ...pipeable(instance)
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions