reactive: github.com/infinytum/reactive Index | Files | Directories

package reactive

import "github.com/infinytum/reactive"

Index

Package Files

buffer_subject.go observable.go pipe.go replay_subject.go skip.go subject.go subjectable.go subscription.go take.go

func Skip Uses

func Skip(count int) func(Observable, Subjectable)

Skip will ignore a specified amount of updates and will pass through all following

func SkipEvery Uses

func SkipEvery(count int) func(Observable, Subjectable)

SkipEvery will skip every {count} update and will pass all others

func Take Uses

func Take(count int) func(Observable, Subjectable)

Take automatically unsubscribes an observable after the given amount of times it has been updated

func TakeEvery Uses

func TakeEvery(count int) func(Observable, Subjectable)

TakeEvery only passes every {count} update to the registered function

type Observable Uses

type Observable interface {
    // AsChannel returns a channel which will receive all
    // further updates of this observable
    AsChannel() chan []interface{}

    // Pipe decorates an observable with one or multiple middlewares
    // and returns a new observable with the decoration applied
    Pipe(fns ...func(Observable, Subjectable)) Observable

    // Subscribe registers a function for further updates of
    // this observable and returns a subscription token which can
    // be used to unsubscribe from it at any time
    Subscribe(fn interface{}) (Subscription, error)

    // Unsubscribe unregisters a previously registered function for all
    // further updates of this observable or until re-registering.
    Unsubscribe(subscription Subscription) error
}

Observable defines the requirements for a class to be considered a valid observable

type Pipe Uses

type Pipe func(Observable, Subjectable)

Pipe is the method signature for a pipe function

type Subjectable Uses

type Subjectable interface {
    Observable

    // Close will remove all subscribers and render
    // the subjectable useless
    Close()

    // Next takes an undefined amount of parameters
    // which will be passed to subscribed functions
    Next(values ...interface{})
}

Subjectable defines required methods for an object to be considered a subject

func NewBufferSubject Uses

func NewBufferSubject(bufferSize int) Subjectable

NewBufferSubject returns a pointer to an empty instance of bufferSubject

func NewReplaySubject Uses

func NewReplaySubject() Subjectable

NewReplaySubject returns a pointer to an empty instance of replaySubject

func NewSubject Uses

func NewSubject() Subjectable

NewSubject returns a pointer to an empty instance of subject

type Subscription Uses

type Subscription uuid.UUID

Subscription represents a string to identify a subscription in an obserable so it can be removed

func EmptySubscription Uses

func EmptySubscription() Subscription

func NewSubscription Uses

func NewSubscription() Subscription

NewSubscription generates a new subscription

Directories

PathSynopsis
internal

Package reactive imports 4 packages (graph). Updated 2019-06-05. Refresh now. Tools for package owners.